aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at
diff options
context:
space:
mode:
authorLorenz <ESs95s3P5z8Pheb>2022-07-17 12:14:29 +0200
committerLorenz <ESs95s3P5z8Pheb>2022-07-17 12:14:29 +0200
commit183c4cfaef952a229bc0abca297269dd8804498c (patch)
treecc8bf413c52a24bd4857f9aa914ba9f46fe289f9 /src/main/java/at
parent36b887ad01eff9bae8d520b4811fce98672ed792 (diff)
downloadskyhanni-183c4cfaef952a229bc0abca297269dd8804498c.tar.gz
skyhanni-183c4cfaef952a229bc0abca297269dd8804498c.tar.bz2
skyhanni-183c4cfaef952a229bc0abca297269dd8804498c.zip
fixed nasty npe around skyblock item id fetch
Diffstat (limited to 'src/main/java/at')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/ItemUtil.kt14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtil.kt b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtil.kt
index d10adc06c..73f507964 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtil.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtil.kt
@@ -96,13 +96,15 @@ object ItemUtil {
fun getItemLore(itemStack: ItemStack): List<String> {
if (itemStack.hasTagCompound() && itemStack.tagCompound.hasKey("display", NBT_COMPOUND)) {
val display = itemStack.tagCompound.getCompoundTag("display")
- if (display.hasKey("Lore", NBT_LIST)) {
- val lore = display.getTagList("Lore", NBT_STRING)
- val loreAsList = ArrayList<String>(lore.tagCount())
- for (lineNumber in 0 until lore.tagCount()) {
- loreAsList.add(lore.getStringTagAt(lineNumber))
+ if (display != null) {
+ if (display.hasKey("Lore", NBT_LIST)) {
+ val lore = display.getTagList("Lore", NBT_STRING)
+ val loreAsList = ArrayList<String>(lore.tagCount())
+ for (lineNumber in 0 until lore.tagCount()) {
+ loreAsList.add(lore.getStringTagAt(lineNumber))
+ }
+ return Collections.unmodifiableList(loreAsList)
}
- return Collections.unmodifiableList(loreAsList)
}
}
return emptyList()