From 6dd779f90bef02f2e23e8ed9b1f292e7a4d899d4 Mon Sep 17 00:00:00 2001 From: Jordan Date: Wed, 26 Jun 2024 21:12:36 +0200 Subject: [PATCH] fix: only write copied value if non null (#2802) - fixes #2801 --- .../com/fastasyncworldedit/core/configuration/Config.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Config.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Config.java index 2a1a5a5ef..1d6f8d146 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Config.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Config.java @@ -320,10 +320,11 @@ public class Config { String node = toNodeName(field.getName()); node = parentNode == null ? node : parentNode + "." + node; Map.Entry entry = copyTo.remove(node); + Object copiedVal; if (entry == null) { - copyTo.put(node,new AbstractMap.SimpleEntry<>(copiedFrom.value(), null)); - } else { - field.set(instance, entry.getValue()); + copyTo.put(node, new AbstractMap.SimpleEntry<>(copiedFrom.value(), null)); + } else if ((copiedVal = entry.getValue()) != null) { + field.set(instance, copiedVal); } } Create create = field.getAnnotation(Create.class);