mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-02-04 17:34:58 +01:00
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
This commit is contained in:
parent
51763382d3
commit
01866db72e
1 changed files with 6 additions and 1 deletions
|
@ -150,7 +150,12 @@ public class SubMenuConfigScreen extends ConfigScreen {
|
||||||
} else if (obj instanceof ForgeConfigSpec.ConfigValue<?>) {
|
} else if (obj instanceof ForgeConfigSpec.ConfigValue<?>) {
|
||||||
ForgeConfigSpec.ConfigValue configValue = (ForgeConfigSpec.ConfigValue<?>) obj;
|
ForgeConfigSpec.ConfigValue configValue = (ForgeConfigSpec.ConfigValue<?>) obj;
|
||||||
ForgeConfigSpec.ValueSpec valueSpec = spec.getRaw((List<String>) configValue.getPath());
|
ForgeConfigSpec.ValueSpec valueSpec = spec.getRaw((List<String>) configValue.getPath());
|
||||||
List<String> comments = new ArrayList<>(Arrays.asList(valueSpec.getComment().split("\n")));
|
|
||||||
|
List<String> comments = new ArrayList<>();
|
||||||
|
|
||||||
|
if (valueSpec.getComment() != null)
|
||||||
|
comments.addAll(Arrays.asList(valueSpec.getComment().split("\n")));
|
||||||
|
|
||||||
Pair<String, Map<String, String>> metadata = ConfigHelper.readMetadataFromComment(comments);
|
Pair<String, Map<String, String>> metadata = ConfigHelper.readMetadataFromComment(comments);
|
||||||
|
|
||||||
ConfigHelper.setValue(String.join(".", configValue.getPath()), configValue, valueSpec.getDefault(), metadata.getSecond());
|
ConfigHelper.setValue(String.join(".", configValue.getPath()), configValue, valueSpec.getDefault(), metadata.getSecond());
|
||||||
|
|
Loading…
Reference in a new issue