From 388976f288039c8154887e3d4deb119af6c3f226 Mon Sep 17 00:00:00 2001 From: Paint_Ninja Date: Thu, 18 Apr 2024 21:32:03 +0100 Subject: [PATCH] Fix NPE when acceptableValues in defineInList() does not allow nulls, backport of #9903 (#9908) Co-authored-by: J-RAP --- src/main/java/net/minecraftforge/common/ForgeConfigSpec.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/minecraftforge/common/ForgeConfigSpec.java b/src/main/java/net/minecraftforge/common/ForgeConfigSpec.java index a399aa1181..de16357a3a 100644 --- a/src/main/java/net/minecraftforge/common/ForgeConfigSpec.java +++ b/src/main/java/net/minecraftforge/common/ForgeConfigSpec.java @@ -350,7 +350,7 @@ public class ForgeConfigSpec extends UnmodifiableConfigWrapper defaultValue, acceptableValues); } public ConfigValue defineInList(List path, Supplier defaultSupplier, Collection acceptableValues) { - return define(path, defaultSupplier, acceptableValues::contains); + return define(path, defaultSupplier, o -> o != null && acceptableValues.contains(o)); } public ConfigValue> defineList(String path, List defaultValue, Predicate elementValidator) { return defineList(split(path), defaultValue, elementValidator);