From 67de5c5e4595ffe87128996b162bade99bcf6f36 Mon Sep 17 00:00:00 2001 From: jani270 <69345714+jani270@users.noreply.github.com> Date: Sat, 25 Nov 2023 14:03:52 +0100 Subject: Fixed 2 crashes with abiphone (#949) --- .../notenoughupdates/profileviewer/level/task/MiscTaskLevel.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') 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 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(); } } -- cgit