From 11d44b1f0f51d0f32403951a28375f8eb735d461 Mon Sep 17 00:00:00 2001 From: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> Date: Fri, 12 Apr 2024 18:42:45 +1000 Subject: Fix kaboom in sacks page (#1088) --- .../notenoughupdates/miscfeatures/profileviewer/SacksPage.kt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/profileviewer/SacksPage.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/profileviewer/SacksPage.kt index 7ef0bc43..cd7186b6 100644 --- a/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/profileviewer/SacksPage.kt +++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/profileviewer/SacksPage.kt @@ -46,7 +46,12 @@ class SacksPage(pvInstance: GuiProfileViewer) : GuiProfileViewerPage(pvInstance) private val manager get() = NotEnoughUpdates.INSTANCE.manager private val pv_sacks = ResourceLocation("notenoughupdates:pv_sacks.png") private var sacksJson = Constants.SACKS - private var sackTypes = sacksJson.getAsJsonObject("sacks") ?: JsonObject() + private var sackTypes = if (sacksJson != null && sacksJson.isJsonObject) { + sacksJson.getAsJsonObject("sacks") ?: JsonObject() + } else { + Utils.showOutdatedRepoNotification("sacks.json") + JsonObject() + } private var tooltipToDisplay = listOf() private var currentProfile: SkyblockProfiles.SkyblockProfile? = null @@ -475,7 +480,10 @@ class SacksPage(pvInstance: GuiProfileViewer) : GuiProfileViewerPage(pvInstance) sackItems.clear() playerRunes.clear() - if (!sacksJson.has("sacks") || !sacksJson.get("sacks").isJsonObject) return + if (!sacksJson.has("sacks") || !sacksJson.get("sacks").isJsonObject) { + Utils.showOutdatedRepoNotification("sacks.json") + return + } val selectedProfile = selectedProfile?.profileJson ?: return val sacksInfo = Utils.getElementOrDefault(selectedProfile, "inventory.sacks_counts", JsonObject()).asJsonObject -- cgit