From dd15e2a01e22cfef18a4cb44b669b050e7728d29 Mon Sep 17 00:00:00 2001 From: Gabriel Tofvesson Date: Tue, 8 Oct 2024 23:36:57 +0200 Subject: [PATCH] Fix nil dereference in getSimpleName --- storage/itemstack.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/storage/itemstack.lua b/storage/itemstack.lua index 6eb57b5..8f545ef 100644 --- a/storage/itemstack.lua +++ b/storage/itemstack.lua @@ -133,7 +133,8 @@ function ItemStack:getSimpleName() return simpleName end - return self:getInventory():getName().."["..self:getSlot().."]" + local inventory = self:getInventory() + return (((inventory and inventory:getName()) or inventory and "[UNKNOWN_INV]") or "[NO_INV]").."["..(self:getSlot() or "NO_SLOT").."]" end function ItemStack:hasChanged(listObj, thorough)