added failsafe in compass if an item doesn't exist

This commit is contained in:
kaadmy 2015-10-12 15:24:37 -07:00
parent 0f3f04f4f1
commit 96130c3407

View File

@ -119,11 +119,13 @@ function step(dtime)
local itemstack = inv:get_stack("main", i)
local item = minetest.registered_items[itemstack:get_name()]
if item.groups.nav_compass then
inv:set_stack("main", i, ItemStack("nav:compass_"..dir))
if item ~= nil then
if item.groups.nav_compass then
inv:set_stack("main", i, ItemStack("nav:compass_"..dir))
end
end
end
end
end
minetest.register_globalstep(step)
minetest.register_globalstep(step)