aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/misc
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-09-09 10:48:30 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-09-09 10:48:30 +0200
commitd4ef47dc97cf8c89fe9182ca2e5cd1ef04bd09d2 (patch)
treea655c16e7fc8a677fd42420efdb510e23bc386b3 /src/main/java/at/hannibal2/skyhanni/features/misc
parent3eccd5fdc94c8ca5afa9da367cbefba54e0a457a (diff)
downloadskyhanni-d4ef47dc97cf8c89fe9182ca2e5cd1ef04bd09d2.tar.gz
skyhanni-d4ef47dc97cf8c89fe9182ca2e5cd1ef04bd09d2.tar.bz2
skyhanni-d4ef47dc97cf8c89fe9182ca2e5cd1ef04bd09d2.zip
fixed crash when item rarity can not be detected in ah browser
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/misc')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt
index 5abc467a1..53e58e4bf 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt
@@ -2,7 +2,7 @@ package at.hannibal2.skyhanni.features.misc
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.utils.*
-import at.hannibal2.skyhanni.utils.ItemUtils.getItemRarity
+import at.hannibal2.skyhanni.utils.ItemUtils.getItemRarityOrNull
import at.hannibal2.skyhanni.utils.ItemUtils.name
import at.hannibal2.skyhanni.utils.LorenzUtils.indexOfFirst
import at.hannibal2.skyhanni.utils.LorenzUtils.round
@@ -42,8 +42,8 @@ class PetExpTooltip {
event.toolTip.add(index, "§7Total experience: §e${NumberUtil.format(petExperience)}")
} else {
val progressBar = StringUtils.progressBar(percentage)
- val isBelowLEgendary = itemStack.getItemRarity() < LorenzRarity.LEGENDARY
- val addLegendaryColor = if (isBelowLEgendary) "§6" else ""
+ val isBelowLegendary = itemStack.getItemRarityOrNull()?.let { it < LorenzRarity.LEGENDARY } ?: false
+ val addLegendaryColor = if (isBelowLegendary) "§6" else ""
event.toolTip.add(index, "$progressBar §e${petExperience.addSeparators()}§6/§e${NumberUtil.format(maxXp)}")
event.toolTip.add(index, "§7Progress to ${addLegendaryColor}Level $maxLevel: §e$percentageFormat")
}