Adds missing null checks before asStringList

This commit is contained in:
Kristian Knarvik 2022-11-05 04:39:18 +01:00
parent ee2b503886
commit d0f4ff11b7
2 changed files with 2 additions and 2 deletions

View File

@ -83,7 +83,7 @@ public class GlobalSettings {
public void changeValue(NPCSetting npcSetting, Object newValue) { public void changeValue(NPCSetting npcSetting, Object newValue) {
if (npcSetting.getValueType() == SettingValueType.STRING_LIST) { if (npcSetting.getValueType() == SettingValueType.STRING_LIST) {
//Workaround to make sure it's treated as the correct type //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 { } else {
defaultNPCSettings.put(npcSetting, newValue); defaultNPCSettings.put(npcSetting, newValue);
} }

View File

@ -68,7 +68,7 @@ public class NPCSettings {
public void changeSetting(NPCSetting setting, Object newValue) { public void changeSetting(NPCSetting setting, Object newValue) {
if (setting.getValueType() == SettingValueType.STRING_LIST) { if (setting.getValueType() == SettingValueType.STRING_LIST) {
//Workaround to make sure it's treated as the correct type //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 { } else {
currentValues.put(setting, newValue); currentValues.put(setting, newValue);
} }