aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjani270 <69345714+jani270@users.noreply.github.com>2023-11-25 14:03:52 +0100
committerGitHub <noreply@github.com>2023-11-26 00:03:52 +1100
commit67de5c5e4595ffe87128996b162bade99bcf6f36 (patch)
treeed897d78c377c96239f19dffe5b9623c7e7061a9 /src
parentb82c11e867f923ddd309775394a6a23ef701e09c (diff)
downloadNotEnoughUpdates-67de5c5e4595ffe87128996b162bade99bcf6f36.tar.gz
NotEnoughUpdates-67de5c5e4595ffe87128996b162bade99bcf6f36.tar.bz2
NotEnoughUpdates-67de5c5e4595ffe87128996b162bade99bcf6f36.zip
Fixed 2 crashes with abiphone (#949)
Diffstat (limited to 'src')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/MiscTaskLevel.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/MiscTaskLevel.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/MiscTaskLevel.java
index 291bf4cf..c0bb9319 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/MiscTaskLevel.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/MiscTaskLevel.java
@@ -74,7 +74,7 @@ public class MiscTaskLevel extends GuiTaskLevel {
JsonObject netherIslandPlayerData = object.getAsJsonObject("nether_island_player_data");
JsonObject abiphoneObject = netherIslandPlayerData.getAsJsonObject("abiphone");
- if (abiphoneObject.has("operator_chip") &&
+ if (abiphoneObject != null && abiphoneObject.has("operator_chip") &&
abiphoneObject.getAsJsonObject("operator_chip").has("repaired_index")) {
int repairedIndex = abiphoneObject.getAsJsonObject("operator_chip").get("repaired_index").getAsInt();
sbXpRelays += (repairedIndex + 1) * miscellaneousTask.get("unlocking_relays_xp").getAsInt();
@@ -104,7 +104,7 @@ public class MiscTaskLevel extends GuiTaskLevel {
JsonArray completedTask = leveling.get("completed_tasks").getAsJsonArray();
Stream<JsonElement> stream = StreamSupport.stream(completedTask.spliterator(), true);
long activeContacts = stream.map(JsonElement::getAsString).filter(s -> s.startsWith("ABIPHONE_")).count();
- if (abiphoneObject.has("active_contacts")) {
+ if (abiphoneObject != null && abiphoneObject.has("active_contacts")) {
sbXpAbiphone = (int) activeContacts * miscellaneousTask.get("abiphone_contacts_xp").getAsInt();
}
}