diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-07-31 11:47:38 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-07-31 11:47:38 +0200 |
commit | 176ff2a1020f741e90fe77ef64dedd401ccbaa8b (patch) | |
tree | ca0a9039d5ecc85e02c6ea7ca94dfb20bbf7eb51 /src/main/java/at/hannibal2/skyhanni/features/garden | |
parent | b7099ea6ba40ae5d832266bfbedea5686068e833 (diff) | |
download | skyhanni-176ff2a1020f741e90fe77ef64dedd401ccbaa8b.tar.gz skyhanni-176ff2a1020f741e90fe77ef64dedd401ccbaa8b.tar.bz2 skyhanni-176ff2a1020f741e90fe77ef64dedd401ccbaa8b.zip |
Soft fixing all RepositoryReloadEvent npe errors
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/garden')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt | 2 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorColorNames.kt | 14 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt index 5c2f569cb..8fe0f2272 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt @@ -421,7 +421,7 @@ class ComposterOverlay { @SubscribeEvent fun onRepoReload(event: RepositoryReloadEvent) { - garden = event.getConstant<GardenJson>("Garden")!! + garden = event.getConstant<GardenJson>("Garden") updateOrganicMatterFactors() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorColorNames.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorColorNames.kt index 789e8e241..84bbf4a4b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorColorNames.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorColorNames.kt @@ -13,13 +13,13 @@ class GardenVisitorColorNames { try { val mapColor = mutableMapOf<String, String>() val mapItems = mutableMapOf<String, List<String>>() - val garden = event.getConstant("Garden")!! - for ((name, element) in garden["visitors"].asJsonObject.entrySet()) { - val jsonObject = element.asJsonObject - val rarity = jsonObject["rarity"].asString - mapColor[name] = getColor(rarity) - mapItems[name] = jsonObject["need_items"].asJsonArray.map { it.asString } - + event.getConstant("Garden")?.let { garden -> + for ((name, element) in garden["visitors"].asJsonObject.entrySet()) { + val jsonObject = element.asJsonObject + val rarity = jsonObject["rarity"].asString + mapColor[name] = getColor(rarity) + mapItems[name] = jsonObject["need_items"].asJsonArray.map { it.asString } + } } visitorColor = mapColor visitorItems = mapItems |