Skip to content

Commit

Permalink
core: Be more defensive about getting null lists
Browse files Browse the repository at this point in the history
  • Loading branch information
zml2008 committed Nov 5, 2020
1 parent af998ae commit 7a8fae6
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,13 @@ public <T> List<T> getList(@NonNull Function<Object, T> transformer, @NonNull Su
public <T> List<T> getList(@NonNull TypeToken<T> type, List<T> def) throws ObjectMappingException {
List<T> ret = getValue(new TypeToken<List<T>>() {}
.where(new TypeParameter<T>() {}, type), def);
return ret.isEmpty() ? storeDefault(def) : ret;
return ret == null || ret.isEmpty() ? storeDefault(def) : ret;
}

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

@Override
Expand Down

0 comments on commit 7a8fae6

Please sign in to comment.