summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim <t4im@users.noreply.github.com>2015-01-29 17:04:07 +0100
committerTim <t4im@users.noreply.github.com>2015-01-29 17:06:09 +0100
commit373c7951d2bb40ba0e5c08a922aa9ece6e6f7dcd (patch)
treec61bd47ba04459ea80c9ed4ba0caf89c9eae625f
parent73b3466a7bee24196ec3b36256d735aff26a9ac4 (diff)
downloadpipeworks-373c7951d2bb40ba0e5c08a922aa9ece6e6f7dcd.tar
pipeworks-373c7951d2bb40ba0e5c08a922aa9ece6e6f7dcd.tar.gz
pipeworks-373c7951d2bb40ba0e5c08a922aa9ece6e6f7dcd.tar.bz2
pipeworks-373c7951d2bb40ba0e5c08a922aa9ece6e6f7dcd.tar.xz
pipeworks-373c7951d2bb40ba0e5c08a922aa9ece6e6f7dcd.zip
add sanity check for upgrade cases of autocrafters with broken metadata (especially for can_dig)
-rw-r--r--autocrafter.lua4
1 files changed, 3 insertions, 1 deletions
diff --git a/autocrafter.lua b/autocrafter.lua
index 012015a..a24560e 100644
--- a/autocrafter.lua
+++ b/autocrafter.lua
@@ -209,7 +209,9 @@ local function upgrade_autocrafter(pos, meta)
-- we allready dropped stuff, so lets remove the metadatasetting (we are not being called again for this node)
meta:set_string("virtual_items", "")
else -- we are version 1
- for idx, stack in ipairs(inv:get_list("recipe")) do
+ local recipe = inv:get_list("recipe")
+ if not recipe then return end
+ for idx, stack in ipairs(recipe) do
if not stack:is_empty() then
minetest.item_drop(stack, "", pos)
stack:set_count(1)