fix: only write copied value if non null (#2802)

-  fixes #2801
This commit is contained in:
Jordan 2024-06-26 21:12:36 +02:00 committed by GitHub
parent 75af797d4c
commit 6dd779f90b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -320,10 +320,11 @@ public class Config {
String node = toNodeName(field.getName());
node = parentNode == null ? node : parentNode + "." + node;
Map.Entry<String, Object> entry = copyTo.remove(node);
Object copiedVal;
if (entry == null) {
copyTo.put(node, new AbstractMap.SimpleEntry<>(copiedFrom.value(), null));
} else {
field.set(instance, entry.getValue());
} else if ((copiedVal = entry.getValue()) != null) {
field.set(instance, copiedVal);
}
}
Create create = field.getAnnotation(Create.class);