Only remove if parent member is object

This commit is contained in:
Frank van der Heijden 2021-08-04 17:32:17 +02:00
parent d2928b4a04
commit c1a6fe269e
No known key found for this signature in database
GPG key ID: B808721C2DD5B5B8

View file

@ -166,7 +166,9 @@ public class JsonConfig implements ServerUtilsConfig {
if (lastDotIndex == -1) {
object = config;
} else {
object = ((JsonConfig) get(path.substring(0, lastDotIndex))).config;
Object obj = get(path.substring(0, lastDotIndex));
if (!(obj instanceof JsonConfig)) return;
object = ((JsonConfig) obj).config;
}
object.remove(path.substring(lastDotIndex + 1));