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
commit2a7a92420d5201ad383fbbcd79fec2f9993b3afd (patch)
treebfd28d1cb1f71f136d505ae1edcaaf3a0a8a30ff
parent4634999a8cd89061e0edc0662c4ceb6a0e4bb9da (diff)
downloadSkyHanni-2a7a92420d5201ad383fbbcd79fec2f9993b3afd.tar.gz
SkyHanni-2a7a92420d5201ad383fbbcd79fec2f9993b3afd.tar.bz2
SkyHanni-2a7a92420d5201ad383fbbcd79fec2f9993b3afd.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") {