diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/ItemUtil.kt | 14 |
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() |