From 1d75ac44c20fafd9f834dc7c01066a85a74f89e7 Mon Sep 17 00:00:00 2001 From: efefury <69400149+efefury@users.noreply.github.com> Date: Thu, 16 Feb 2023 11:51:40 +0000 Subject: Fix NPE in Level Page (v2) (#617) --- .../notenoughupdates/profileviewer/level/task/CoreTaskLevel.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/CoreTaskLevel.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/CoreTaskLevel.java index fde43cd1..8bb26b09 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/CoreTaskLevel.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/CoreTaskLevel.java @@ -82,14 +82,16 @@ public class CoreTaskLevel { // mp acc int sbXpGainedMp = 0; - if (object.has("accessory_bag_storage")) { + if (object.has("accessory_bag_storage") && + object.getAsJsonObject("accessory_bag_storage").has("highest_magical_power")) { sbXpGainedMp = object.getAsJsonObject("accessory_bag_storage").get("highest_magical_power").getAsInt(); } // pets int petScore = 0; - if (object.has("leveling") && object.getAsJsonObject("leveling").has("highest_pet_score")) { + if (object.has("leveling") && + object.getAsJsonObject("leveling").has("highest_pet_score")) { petScore = object.getAsJsonObject("leveling").get("highest_pet_score").getAsInt(); } -- cgit