From 4c185269d24ab0418852e09d5f4996e5aa1d112e Mon Sep 17 00:00:00 2001 From: LudoCrypt <60561627+LudoCrypt@users.noreply.github.com> Date: Tue, 22 Aug 2023 15:23:51 -0500 Subject: [PATCH] Fix Decoding Crash --- build.gradle | 2 +- .../infernalstudios/abs/rules/SpawningRules.java | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/build.gradle b/build.gradle index 327a5d3..adc8fbb 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ plugins { id 'net.minecraftforge.gradle' version '5.1.+' } -version = '1.0' +version = '1.0.1' group = 'org.infernalstudios.abs' archivesBaseName = 'abs' diff --git a/src/main/java/org/infernalstudios/abs/rules/SpawningRules.java b/src/main/java/org/infernalstudios/abs/rules/SpawningRules.java index 5db937d..80bc632 100644 --- a/src/main/java/org/infernalstudios/abs/rules/SpawningRules.java +++ b/src/main/java/org/infernalstudios/abs/rules/SpawningRules.java @@ -96,13 +96,15 @@ public static SpawningRules decode(JsonElement element) { FilterRules include = FilterRules.empty(); FilterRules exclude = FilterRules.empty(); - JsonObject json = element.getAsJsonObject(); - if (json.has("include")) { - include = FilterRules.decode(json.get("include")); - } + if (element != null) { + JsonObject json = element.getAsJsonObject(); + if (json.has("include")) { + include = FilterRules.decode(json.get("include")); + } - if (json.has("exclude")) { - exclude = FilterRules.decode(json.get("exclude")); + if (json.has("exclude")) { + exclude = FilterRules.decode(json.get("exclude")); + } } return new SpawningRules(include, exclude);