From d0f4ff11b7398f4f3cffdbb5cfb0904aeaa98e4a Mon Sep 17 00:00:00 2001 From: EpicKnarvik97 Date: Sat, 5 Nov 2022 04:39:18 +0100 Subject: [PATCH] Adds missing null checks before asStringList --- .../java/net/knarcraft/blacksmith/config/GlobalSettings.java | 2 +- src/main/java/net/knarcraft/blacksmith/config/NPCSettings.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/knarcraft/blacksmith/config/GlobalSettings.java b/src/main/java/net/knarcraft/blacksmith/config/GlobalSettings.java index 4a59cfa..25838e8 100644 --- a/src/main/java/net/knarcraft/blacksmith/config/GlobalSettings.java +++ b/src/main/java/net/knarcraft/blacksmith/config/GlobalSettings.java @@ -83,7 +83,7 @@ public class GlobalSettings { public void changeValue(NPCSetting npcSetting, Object newValue) { if (npcSetting.getValueType() == SettingValueType.STRING_LIST) { //Workaround to make sure it's treated as the correct type - defaultNPCSettings.put(npcSetting, ConfigHelper.asStringList(newValue)); + defaultNPCSettings.put(npcSetting, newValue == null ? null : ConfigHelper.asStringList(newValue)); } else { defaultNPCSettings.put(npcSetting, newValue); } diff --git a/src/main/java/net/knarcraft/blacksmith/config/NPCSettings.java b/src/main/java/net/knarcraft/blacksmith/config/NPCSettings.java index 0541816..a70d77f 100644 --- a/src/main/java/net/knarcraft/blacksmith/config/NPCSettings.java +++ b/src/main/java/net/knarcraft/blacksmith/config/NPCSettings.java @@ -68,7 +68,7 @@ public class NPCSettings { public void changeSetting(NPCSetting setting, Object newValue) { if (setting.getValueType() == SettingValueType.STRING_LIST) { //Workaround to make sure it's treated as the correct type - currentValues.put(setting, ConfigHelper.asStringList(newValue)); + currentValues.put(setting, newValue == null ? null : ConfigHelper.asStringList(newValue)); } else { currentValues.put(setting, newValue); }