summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Martínez <lkaezadl3@yahoo.com>2016-10-08 00:54:05 -0300
committerDiego Martínez <lkaezadl3@yahoo.com>2016-10-08 00:54:05 -0300
commit5b9a53bf293ee07885a2c1ef35d809d356dd672d (patch)
tree5dc496eb59be69e23928134aeae97eae2ccb210c
parentf6ea3daef7ab6acdf4156e8e8347c3d536bb4fb4 (diff)
Fail gracefully for invalid drop tables.
Notified by user `photon` on IRC.
-rw-r--r--api.lua6
1 files changed, 4 insertions, 2 deletions
diff --git a/api.lua b/api.lua
index 936ee72..9f3ade0 100644
--- a/api.lua
+++ b/api.lua
@@ -82,9 +82,11 @@ minetest.after(0.01, function()
-- appears after a “maybe”
local max_start = true
-- Let's iterate through the items madness!
- for i=1,#def.drop.items do
+ -- Handle invalid drop entries gracefully.
+ local drop_items = def.drop.items or { }
+ for i=1,#drop_items do
if max_items_left ~= nil and max_items_left <= 0 then break end
- local itit = def.drop.items[i]
+ local itit = drop_items[i]
for j=1,#itit.items do
local dstack = ItemStack(itit.items[j])
if not dstack:is_empty() and dstack:get_name() ~= name then