From 3249b2c36d3af4d5d6014385fb7a1ce143dadf31 Mon Sep 17 00:00:00 2001 From: kr45732 <52721908+kr45732@users.noreply.github.com> Date: Sun, 9 Jul 2023 14:04:43 -0400 Subject: Fix leveling info related crash (#767) --- .../notenoughupdates/profileviewer/DungeonPage.java | 3 +++ .../notenoughupdates/profileviewer/MiningPage.java | 13 +++++++++---- .../moulberry/notenoughupdates/util/XPInformation.java | 3 +++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/DungeonPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/DungeonPage.java index 66c7c2a1..980a488f 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/DungeonPage.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/DungeonPage.java @@ -127,6 +127,9 @@ public class DungeonPage extends GuiProfileViewerPage { } Map levelingInfo = selectedProfile.getLevelingInfo(); + if (levelingInfo == null) { + return; + } JsonObject profileInfo = selectedProfile.getProfileJson(); JsonObject hypixelInfo = GuiProfileViewer.getProfile().getHypixelProfile(); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/MiningPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/MiningPage.java index c0824bf5..792b1b80 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/MiningPage.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/MiningPage.java @@ -19,6 +19,7 @@ package io.github.moulberry.notenoughupdates.profileviewer; +import io.github.moulberry.notenoughupdates.profileviewer.ProfileViewer; import com.google.common.collect.Lists; import com.google.gson.JsonObject; import io.github.moulberry.notenoughupdates.core.util.StringUtils; @@ -151,11 +152,15 @@ public class MiningPage extends GuiProfileViewerPage { molePerkPct = 100; } - ProfileViewer.Level hotmLevelingInfo = selectedProfile.getLevelingInfo().get("hotm"); - // Render stats - // HOTM - getInstance().renderXpBar(EnumChatFormatting.RED + "HOTM", hotmSkillIcon, x, y, sectionWidth, hotmLevelingInfo, mouseX, mouseY); + Map levelingInfo = selectedProfile.getLevelingInfo(); + if (levelingInfo != null) { + ProfileViewer.Level hotmLevelingInfo = levelingInfo.get("hotm"); + + // HOTM + getInstance().renderXpBar(EnumChatFormatting.RED + "HOTM", hotmSkillIcon, x, y, sectionWidth, hotmLevelingInfo, mouseX, mouseY); + } + // Powder Utils.renderAlignedString( diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java b/src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java index c4c85597..0a501415 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java @@ -233,6 +233,9 @@ public class XPInformation { private void onApiUpdated(SkyblockProfiles profile) { Map skyblockInfo = profile.getLatestProfile().getLevelingInfo(); + if (skyblockInfo == null) { + return; + } for (String skill : skills) { SkillInfo info = new SkillInfo(); -- cgit