Fix crash when trying to repair unknown items

This commit is contained in:
ShadowNinja 2014-05-30 20:58:32 -04:00
parent b74c2d38b9
commit 7c2f2d9630

View File

@ -62,9 +62,12 @@ minetest.register_abm({
local repairable = false local repairable = false
local srcstack = inv:get_stack("src", 1) local srcstack = inv:get_stack("src", 1)
if (not srcstack:is_empty("src")) then if not srcstack:is_empty("src") then
local itemdef = minetest.registered_items[srcstack:get_name()] local itemdef = minetest.registered_items[srcstack:get_name()]
if (itemdef.wear_represents or "mechanical_wear") == "mechanical_wear" and srcstack:get_wear() ~= 0 then if itemdef and
itemdef.wear_represents and
itemdef.wear_represents == "mechanical_wear" and
srcstack:get_wear() ~= 0 then
repairable = true repairable = true
end end
end end