From: Novatux Date: Sat, 21 Jun 2014 06:29:41 +0000 (+0200) Subject: Fix crash with legacy nodebreakers X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=5a5bb3bf1287e3d046c7eabc28409549845b7fef;p=zefram%2Fminetest%2Fpipeworks.git Fix crash with legacy nodebreakers --- diff --git a/node_breaker.lua b/node_breaker.lua index 21c5194..a25ca32 100644 --- a/node_breaker.lua +++ b/node_breaker.lua @@ -271,9 +271,11 @@ minetest.register_node("pipeworks:nodebreaker_off", { minetest.get_meta(pos):set_string("owner", placer:get_player_name()) end, after_dig_node = function(pos, oldnode, oldmetadata, digger) - local stack = oldmetadata.inventory.pick[1] - if not stack:is_empty() then - minetest.add_item(pos, stack) + if oldmetadata.inventory.pick then + local stack = oldmetadata.inventory.pick[1] + if not stack:is_empty() then + minetest.add_item(pos, stack) + end end pipeworks.scan_for_tube_objects(pos, oldnode, oldmetadata, digger) end, @@ -369,9 +371,11 @@ minetest.register_node("pipeworks:nodebreaker_on", { minetest.get_meta(pos):set_string("owner", placer:get_player_name()) end, after_dig_node = function(pos, oldnode, oldmetadata, digger) - local stack = oldmetadata.inventory.pick[1] - if not stack:is_empty() then - minetest.add_item(pos, stack) + if oldmetadata.inventory.pick then + local stack = oldmetadata.inventory.pick[1] + if not stack:is_empty() then + minetest.add_item(pos, stack) + end end pipeworks.scan_for_tube_objects(pos, oldnode, oldmetadata, digger) end,