From d3108574a249d53aa7b075cdbf0604510680ced6 Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Sun, 20 Oct 2024 14:35:50 +0200 Subject: [PATCH] Fix error in LBM caused by mod-placed nodes --- init.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 1b419cc..61f0188 100644 --- a/init.lua +++ b/init.lua @@ -269,7 +269,8 @@ minetest.register_lbm({ action = function(pos, node) local meta = minetest.get_meta(pos) 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) inv:set_stack("rec", i, item:peek_item()) local leftover = inv:add_item("dst", item)