From d11733a48cc49f2b3265930ff699989c108f2733 Mon Sep 17 00:00:00 2001 From: Paint_Ninja Date: Wed, 1 May 2024 21:58:24 +0100 Subject: [PATCH] Fix NPE when acceptableValues in defineInList() does not allow nulls, fixes #9300, backport of #9903 (#9910) Co-Authored-By: J-RAP --- docs/README.md | 6 +++--- .../java/net/minecraftforge/common/ForgeConfigSpec.java | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/README.md b/docs/README.md index f7bd15bdb7..0a5aec4f6d 100644 --- a/docs/README.md +++ b/docs/README.md @@ -37,18 +37,18 @@ For support and questions, visit [the Support Forum][Support-Forum] or [the Forg # Creating Mods -[See the "Getting Started" section in the Forge Documentation](https://mcforge.readthedocs.io/en/latest/gettingstarted/). +[See the "Getting Started" section in the Forge Documentation](https://docs.minecraftforge.net/en/1.18.x/gettingstarted/). # Contribute to Forge If you wish to actually inspect Forge, submit PRs or otherwise work with Forge itself, you're in the right place! - [See the guide to setting up a Forge workspace](http://mcforge.readthedocs.io/en/latest/forgedev/). + [See the guide to setting up a Forge workspace](https://docs.minecraftforge.net/en/1.18.x/forgedev/). ### Pull requests -[See the "Making Changes and Pull Requests" section in the Forge documentation](https://mcforge.readthedocs.io/en/latest/forgedev/#making-changes-and-pull-requests). +[See the "Making Changes and Pull Requests" section in the Forge documentation](https://docs.minecraftforge.net/en/1.18.x/forgedev/#making-changes-and-pull-requests). Please read the contributing guidelines found [here](CONTRIBUTING.md) before making a pull request. diff --git a/src/main/java/net/minecraftforge/common/ForgeConfigSpec.java b/src/main/java/net/minecraftforge/common/ForgeConfigSpec.java index 5ffdbb4db1..4521a718c6 100644 --- a/src/main/java/net/minecraftforge/common/ForgeConfigSpec.java +++ b/src/main/java/net/minecraftforge/common/ForgeConfigSpec.java @@ -353,7 +353,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);