From e1b8e8c73fa6d12cea25b26dc2ce0d3699c876df Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 11 Mar 2023 17:17:04 +0100 Subject: Fixed npe in collection api --- src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') 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") { -- cgit