Fix NPE when acceptableValues in defineInList() does not allow nulls, fixes #9300 (#9903)

This commit is contained in:
J-RAP authored and GitHub committed 2024-04-13 12:47:35 +01:00
1 parent 8e16765438
commit d31ea640f9
1 file changed
+1 -1
@@ -330,7 +330,7 @@ public class ForgeConfigSpec extends UnmodifiableConfigWrapper<UnmodifiableConfi
return defineInList(path, () -> defaultValue, acceptableValues);
}
public <T> ConfigValue<T> defineInList(List<String> path, Supplier<T> defaultSupplier, Collection<? extends T> acceptableValues) {
return define(path, defaultSupplier, acceptableValues::contains);
return define(path, defaultSupplier, o -> o != null && acceptableValues.contains(o));
}
//endregion