From 01866db72eec4fca879565fb388828bf6cf0f882 Mon Sep 17 00:00:00 2001 From: Cael Warner <52902343+CaelWarner@users.noreply.github.com> Date: Sat, 11 Dec 2021 20:58:23 -0800 Subject: [PATCH] Fixed null pointer when resetting gameplay settings in config menu - Added a null check to make sure a config value has a comment before trying to split the comment - Fixes #2412 --- .../create/foundation/config/ui/SubMenuConfigScreen.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/simibubi/create/foundation/config/ui/SubMenuConfigScreen.java b/src/main/java/com/simibubi/create/foundation/config/ui/SubMenuConfigScreen.java index fac3d6fa5..53b12052a 100644 --- a/src/main/java/com/simibubi/create/foundation/config/ui/SubMenuConfigScreen.java +++ b/src/main/java/com/simibubi/create/foundation/config/ui/SubMenuConfigScreen.java @@ -150,7 +150,12 @@ public class SubMenuConfigScreen extends ConfigScreen { } else if (obj instanceof ForgeConfigSpec.ConfigValue) { ForgeConfigSpec.ConfigValue configValue = (ForgeConfigSpec.ConfigValue) obj; ForgeConfigSpec.ValueSpec valueSpec = spec.getRaw((List) configValue.getPath()); - List comments = new ArrayList<>(Arrays.asList(valueSpec.getComment().split("\n"))); + + List comments = new ArrayList<>(); + + if (valueSpec.getComment() != null) + comments.addAll(Arrays.asList(valueSpec.getComment().split("\n"))); + Pair> metadata = ConfigHelper.readMetadataFromComment(comments); ConfigHelper.setValue(String.join(".", configValue.getPath()), configValue, valueSpec.getDefault(), metadata.getSecond());