diff options
author | CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> | 2024-04-12 18:42:45 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-12 10:42:45 +0200 |
commit | 11d44b1f0f51d0f32403951a28375f8eb735d461 (patch) | |
tree | a11e89618ccdc86c3389f33c355072792946c617 /src/main/kotlin/io | |
parent | 3cd5ec334fb6cbbdf4e44f471c9895cca8db1000 (diff) | |
download | NotEnoughUpdates-11d44b1f0f51d0f32403951a28375f8eb735d461.tar.gz NotEnoughUpdates-11d44b1f0f51d0f32403951a28375f8eb735d461.tar.bz2 NotEnoughUpdates-11d44b1f0f51d0f32403951a28375f8eb735d461.zip |
Fix kaboom in sacks page (#1088)
Diffstat (limited to 'src/main/kotlin/io')
-rw-r--r-- | src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/profileviewer/SacksPage.kt | 12 |
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 |