aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCalMWolfs <94038482+CalMWolfs@users.noreply.github.com>2024-04-12 18:42:45 +1000
committerGitHub <noreply@github.com>2024-04-12 10:42:45 +0200
commit11d44b1f0f51d0f32403951a28375f8eb735d461 (patch)
treea11e89618ccdc86c3389f33c355072792946c617 /src
parent3cd5ec334fb6cbbdf4e44f471c9895cca8db1000 (diff)
downloadNotEnoughUpdates-11d44b1f0f51d0f32403951a28375f8eb735d461.tar.gz
NotEnoughUpdates-11d44b1f0f51d0f32403951a28375f8eb735d461.tar.bz2
NotEnoughUpdates-11d44b1f0f51d0f32403951a28375f8eb735d461.zip
Fix kaboom in sacks page (#1088)
Diffstat (limited to 'src')
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/profileviewer/SacksPage.kt12
1 files 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<String>()
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