aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-03-11 17:17:04 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-03-11 17:17:04 +0100
commite1b8e8c73fa6d12cea25b26dc2ce0d3699c876df (patch)
treebfd28d1cb1f71f136d505ae1edcaaf3a0a8a30ff
parent8390612f3e956e77dd2523d003e4df9f61e370b4 (diff)
downloadskyhanni-e1b8e8c73fa6d12cea25b26dc2ce0d3699c876df.tar.gz
skyhanni-e1b8e8c73fa6d12cea25b26dc2ce0d3699c876df.tar.bz2
skyhanni-e1b8e8c73fa6d12cea25b26dc2ce0d3699c876df.zip
Fixed npe in collection api
-rw-r--r--src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt b/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt
index e79e60dfb..af1be6bc4 100644
--- a/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt
@@ -17,7 +17,9 @@ class CollectionAPI {
@SubscribeEvent
fun onProfileDataLoad(event: ProfileApiDataLoadedEvent) {
val profileData = event.profileData
- for ((rawName, rawCounter) in profileData["collection"].asJsonObject.entrySet()) {
+ val jsonElement = profileData["collection"]?: return
+ val asJsonObject = jsonElement.asJsonObject ?: return
+ for ((rawName, rawCounter) in asJsonObject.entrySet()) {
val counter = rawCounter.asLong
var itemName = BazaarApi.getBazaarDataForInternalName(rawName)?.itemName
if (rawName == "MUSHROOM_COLLECTION") {