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,8 +119,10 @@ function step(dtime)
local itemstack = inv:get_stack("main", i) local itemstack = inv:get_stack("main", i)
local item = minetest.registered_items[itemstack:get_name()] local item = minetest.registered_items[itemstack:get_name()]
if item.groups.nav_compass then if item ~= nil then
inv:set_stack("main", i, ItemStack("nav:compass_"..dir)) if item.groups.nav_compass then
inv:set_stack("main", i, ItemStack("nav:compass_"..dir))
end
end end
end end
end end