aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCow <cow@volloeko.de>2023-07-16 12:08:10 +0200
committerCow <cow@volloeko.de>2023-07-16 12:08:10 +0200
commit24c9e641a1dc0c109d94504ef707a10171b837c4 (patch)
treeadd8049a1cb0f2e81fca4d0b1a8d50eb8f0e8992 /src
parentf30851154f185fba3ce8877fa2ee17894844003d (diff)
downloadCowlection-24c9e641a1dc0c109d94504ef707a10171b837c4.tar.gz
Cowlection-24c9e641a1dc0c109d94504ef707a10171b837c4.tar.bz2
Cowlection-24c9e641a1dc0c109d94504ef707a10171b837c4.zip
Fixed rare crash caused by unexpected NBT data typing
Diffstat (limited to 'src')
-rw-r--r--src/main/java/de/cowtipper/cowlection/listener/skyblock/SkyBlockListener.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/main/java/de/cowtipper/cowlection/listener/skyblock/SkyBlockListener.java b/src/main/java/de/cowtipper/cowlection/listener/skyblock/SkyBlockListener.java
index 21fa20d..f1d9108 100644
--- a/src/main/java/de/cowtipper/cowlection/listener/skyblock/SkyBlockListener.java
+++ b/src/main/java/de/cowtipper/cowlection/listener/skyblock/SkyBlockListener.java
@@ -207,11 +207,13 @@ public class SkyBlockListener {
if ((MooConfig.getTooltipPetExpDisplay() == MooConfig.Setting.ALWAYS
|| MooConfig.getTooltipPetExpDisplay() == MooConfig.Setting.SPECIAL && MooConfig.isTooltipToggleKeyBindingPressed())
&& e.itemStack.getItem() == Items.skull) {
- if (extraAttributes != null && extraAttributes.hasKey("petInfo")) {
+ if (extraAttributes != null && extraAttributes.hasKey("petInfo", (byte) 8 /* string */)) {
// pet in inventory, auction house or similar
HySkyBlockStats.Profile.Pet petInfo = GsonUtils.fromJson(extraAttributes.getString("petInfo"), HySkyBlockStats.Profile.Pet.class);
- int index = Math.max(0, e.toolTip.size() - (e.showAdvancedItemTooltips ? /* item name & nbt info */ 2 : 0));
- e.toolTip.add(index, EnumChatFormatting.GRAY + "Pet exp: " + EnumChatFormatting.GOLD + numberFormatter.format(petInfo.getExp()));
+ if (petInfo != null) {
+ int index = Math.max(0, e.toolTip.size() - (e.showAdvancedItemTooltips ? /* item name & nbt info */ 2 : 0));
+ e.toolTip.add(index, EnumChatFormatting.GRAY + "Pet exp: " + EnumChatFormatting.GOLD + numberFormatter.format(petInfo.getExp()));
+ }
} else if (e.itemStack.getDisplayName().contains("[Lvl ")) {
// pet in pets menu
for (int i = e.toolTip.size() - 1; i >= 0; i--) {