Fix crash with legacy nodebreakers
authorNovatux <nathanael.courant@laposte.net>
Sat, 21 Jun 2014 06:29:41 +0000 (08:29 +0200)
committerNovatux <nathanael.courant@laposte.net>
Sat, 21 Jun 2014 06:29:41 +0000 (08:29 +0200)
node_breaker.lua

index 21c5194003edf082b4c0c94e4c79333122f14ddb..a25ca32643d31fd4fc0da46a278faa32b93b091c 100644 (file)
@@ -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,