Merge pull request #2660 from open-osrs/configmanager-log-null-defaults-without-crashing

configmanager: log null defaults without crashing
This commit is contained in:
ThatGamerBlue
2020-06-04 02:01:18 +01:00
committed by GitHub

View File

@@ -753,6 +753,11 @@ public class ConfigManager
}
String current = getConfiguration(group.value(), item.keyName());
if (defaultValue == null)
{
log.error("Plugin with bad default configuration, see config group {}, keyName {}", group.value(), item.keyName());
continue;
}
String valueString = objectToString(defaultValue);
// null and the empty string are treated identically in sendConfig and treated as an unset
// If a config value defaults to "" and the current value is null, it will cause an extra
@@ -884,4 +889,4 @@ public class ConfigManager
{
return consumers.getOrDefault(configGroup + "." + keyName, (p) -> log.error("Failed to retrieve consumer with name {}.{}", configGroup, keyName));
}
}
}