Fix error in LBM caused by mod-placed nodes

This commit is contained in:
SmallJoker 2024-10-20 14:35:50 +02:00
parent b8353d781b
commit d3108574a2

@ -269,7 +269,8 @@ minetest.register_lbm({
action = function(pos, node) action = function(pos, node)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local inv = meta:get_inventory() local inv = meta:get_inventory()
for i, item in ipairs(inv:get_list("rec")) do -- `get_list` may return `nil` when the node was placed without calling `on_construct`
for i, item in ipairs(inv:get_list("rec") or {}) do
-- Limit to stack size 1 (or keep empty) -- Limit to stack size 1 (or keep empty)
inv:set_stack("rec", i, item:peek_item()) inv:set_stack("rec", i, item:peek_item())
local leftover = inv:add_item("dst", item) local leftover = inv:add_item("dst", item)