aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/ledger/ItemUtil.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/moe/nea/ledger/ItemUtil.kt')
-rw-r--r--src/main/kotlin/moe/nea/ledger/ItemUtil.kt3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/main/kotlin/moe/nea/ledger/ItemUtil.kt b/src/main/kotlin/moe/nea/ledger/ItemUtil.kt
index cadcb66..4bbd4cd 100644
--- a/src/main/kotlin/moe/nea/ledger/ItemUtil.kt
+++ b/src/main/kotlin/moe/nea/ledger/ItemUtil.kt
@@ -9,7 +9,8 @@ fun ItemStack.getExtraAttributes(): NBTTagCompound {
return nbt.getCompoundTag("ExtraAttributes")
}
-fun ItemStack.getInternalId(): ItemId? {
+fun ItemStack?.getInternalId(): ItemId? {
+ if (this == null) return null
val extraAttributes = getExtraAttributes()
var id = extraAttributes.getString("id")
id = id.takeIf { it.isNotBlank() }