Skip to content

Commit 7a8fae6

Browse files
committed
core: Be more defensive about getting null lists
1 parent af998ae commit 7a8fae6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

configurate-core/src/main/java/ninja/leaping/configurate/SimpleConfigurationNode.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,13 +204,13 @@ public <T> List<T> getList(@NonNull Function<Object, T> transformer, @NonNull Su
204204
public <T> List<T> getList(@NonNull TypeToken<T> type, List<T> def) throws ObjectMappingException {
205205
List<T> ret = getValue(new TypeToken<List<T>>() {}
206206
.where(new TypeParameter<T>() {}, type), def);
207-
return ret.isEmpty() ? storeDefault(def) : ret;
207+
return ret == null || ret.isEmpty() ? storeDefault(def) : ret;
208208
}
209209

210210
@Override
211211
public <T> List<T> getList(@NonNull TypeToken<T> type, @NonNull Supplier<List<T>> defSupplier) throws ObjectMappingException {
212212
List<T> ret = getValue(new TypeToken<List<T>>(){}.where(new TypeParameter<T>(){}, type), defSupplier);
213-
return ret.isEmpty() ? storeDefault(defSupplier.get()) : ret;
213+
return ret == null || ret.isEmpty() ? storeDefault(defSupplier.get()) : ret;
214214
}
215215

216216
@Override

0 commit comments

Comments
 (0)