From 2b0ce6f63e176c773c44711efb36f161fe48085c Mon Sep 17 00:00:00 2001 From: stujones11 Date: Fri, 17 Apr 2015 19:41:15 +0100 Subject: [PATCH] Check node is not nil before indexing --- 3d_armor/armor.lua | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/3d_armor/armor.lua b/3d_armor/armor.lua index 1aaf99d..7780d95 100644 --- a/3d_armor/armor.lua +++ b/3d_armor/armor.lua @@ -506,15 +506,17 @@ if ARMOR_DROP == true or ARMOR_DESTROY == true then minetest.after(ARMOR_BONES_DELAY, function() pos = vector.round(pos) local node = minetest.get_node(pos) - if node and node.name == "bones:bones" then - local meta = minetest.get_meta(pos) - local owner = meta:get_string("owner") - local inv = meta:get_inventory() - for _,stack in ipairs(drop) do - if name == owner and inv:room_for_item("main", stack) then - inv:add_item("main", stack) - else - armor.drop_armor(pos, stack) + if node then + if node.name == "bones:bones" then + local meta = minetest.get_meta(pos) + local owner = meta:get_string("owner") + local inv = meta:get_inventory() + for _,stack in ipairs(drop) do + if name == owner and inv:room_for_item("main", stack) then + inv:add_item("main", stack) + else + armor.drop_armor(pos, stack) + end end end else