forked from minetest-mods/unified_inventory
Fail gracefully for invalid drop tables.
Notified by user `photon` on IRC.
This commit is contained in:
parent
f6ea3daef7
commit
5b9a53bf29
6
api.lua
6
api.lua
@ -82,9 +82,11 @@ minetest.after(0.01, function()
|
|||||||
-- appears after a “maybe”
|
-- appears after a “maybe”
|
||||||
local max_start = true
|
local max_start = true
|
||||||
-- Let's iterate through the items madness!
|
-- 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
|
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
|
for j=1,#itit.items do
|
||||||
local dstack = ItemStack(itit.items[j])
|
local dstack = ItemStack(itit.items[j])
|
||||||
if not dstack:is_empty() and dstack:get_name() ~= name then
|
if not dstack:is_empty() and dstack:get_name() ~= name then
|
||||||
|
Loading…
Reference in New Issue
Block a user