Check node is not nil before indexing

This commit is contained in:
stujones11 2015-04-17 19:41:15 +01:00
parent 3badcea0d9
commit 2b0ce6f63e

View File

@ -506,7 +506,8 @@ if ARMOR_DROP == true or ARMOR_DESTROY == true then
minetest.after(ARMOR_BONES_DELAY, function() minetest.after(ARMOR_BONES_DELAY, function()
pos = vector.round(pos) pos = vector.round(pos)
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
if node and node.name == "bones:bones" then if node then
if node.name == "bones:bones" then
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local owner = meta:get_string("owner") local owner = meta:get_string("owner")
local inv = meta:get_inventory() local inv = meta:get_inventory()
@ -517,6 +518,7 @@ if ARMOR_DROP == true or ARMOR_DESTROY == true then
armor.drop_armor(pos, stack) armor.drop_armor(pos, stack)
end end
end end
end
else else
for _,stack in ipairs(drop) do for _,stack in ipairs(drop) do
armor.drop_armor(pos, stack) armor.drop_armor(pos, stack)