Fix nil dereference in getSimpleName

This commit is contained in:
Gabriel Tofvesson 2024-10-08 23:36:57 +02:00
parent 20fda03d50
commit dd15e2a01e

View File

@ -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)