Skip to content

Commit

Permalink
no longer passing null-values to value-converters
Browse files Browse the repository at this point in the history
  • Loading branch information
BlvckBytes committed Sep 17, 2024
1 parent 5a6f3fa commit 4c7323f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/java/me/blvckbytes/bbconfigmapper/ConfigMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,13 @@ private <T extends IConfigSection> T mapSectionSub(@Nullable String root, @Nulla

Object value = resolveFieldValue(root, source, f, fieldType);

if (converter != null)
value = converter.apply(value, evaluator);

// Couldn't resolve a non-null value, try to ask for a default value
if (value == null)
value = instance.defaultFor(f);

if (value != null && converter != null)
value = converter.apply(value, evaluator);

// Only set if the value isn't null, as the default constructor
// might have already assigned some default value earlier
if (value == null)
Expand Down

0 comments on commit 4c7323f

Please sign in to comment.