aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-07-06 00:18:11 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-07-06 00:18:11 +0200
commit9c612fe9c3dd9eba2d2aeaf2b5500238235bbcdb (patch)
treeaf1e60af927aad8ad8912481cc42d80d02a1793d /src/main/java/at
parent01d97520af807c32b2386ba0702a171819fa3009 (diff)
downloadskyhanni-9c612fe9c3dd9eba2d2aeaf2b5500238235bbcdb.tar.gz
skyhanni-9c612fe9c3dd9eba2d2aeaf2b5500238235bbcdb.tar.bz2
skyhanni-9c612fe9c3dd9eba2d2aeaf2b5500238235bbcdb.zip
Workaround to not crash if visitor rarities is empty
Diffstat (limited to 'src/main/java/at')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt
index fef655811..97206b254 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt
@@ -7,6 +7,7 @@ import at.hannibal2.skyhanni.events.GuiRenderEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.PreProfileSwitchEvent
import at.hannibal2.skyhanni.features.garden.GardenAPI
+import at.hannibal2.skyhanni.test.command.CopyErrorCommand
import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList
import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy
import at.hannibal2.skyhanni.utils.NEUItems
@@ -104,12 +105,17 @@ object GardenVisitorDropStatistics {
//1
addAsSingletonList(format(totalVisitors, "Total", "§e", ""))
//2
- addAsSingletonList(
- "§a${visitorRarities[0].addSeparators()}§f-" +
- "§9${visitorRarities[1].addSeparators()}§f-" +
- "§6${visitorRarities[2].addSeparators()}§f-" +
- "§c${visitorRarities[3].addSeparators()}"
- )
+ if (visitorRarities.isNotEmpty()) {
+ addAsSingletonList(
+ "§a${visitorRarities[0].addSeparators()}§f-" +
+ "§9${visitorRarities[1].addSeparators()}§f-" +
+ "§6${visitorRarities[2].addSeparators()}§f-" +
+ "§c${visitorRarities[3].addSeparators()}"
+ )
+ } else {
+ addAsSingletonList("§c?")
+ CopyErrorCommand.logError(RuntimeException("visitorRarities is empty"), "Error rendering visitor drop statistics")
+ }
//3
addAsSingletonList(format(acceptedVisitors, "Accepted", "§2", ""))
//4