From 6e11868d1b32d316d60061c78460d260ac92ed6a Mon Sep 17 00:00:00 2001 From: Luke aka SwissalpS <161979+SwissalpS@users.noreply.github.com> Date: Fri, 4 Jul 2025 16:28:05 +0200 Subject: [PATCH] Fix LBM filter injector crashing server when injector wasn't initialized properly (#168) * check for existance of list param I'm not sure this actually fixes the problem. The issue was raised because of broken map data. * actually fix the crash --- filter-injector.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/filter-injector.lua b/filter-injector.lua index 5aba659..ffa4e12 100644 --- a/filter-injector.lua +++ b/filter-injector.lua @@ -558,9 +558,10 @@ local function put_to_inputinv(pos, node, filtmeta, list) local frompos = vector.subtract(pos, dir) local fromnode = core.get_node(frompos) local fromdef = core.registered_nodes[fromnode.name] - if not fromdef or not fromdef.tube then + if not (fromdef and fromdef.tube) then return end + local fromtube = fromdef.tube local frominv if fromtube.return_input_invref then @@ -577,6 +578,7 @@ local function put_to_inputinv(pos, node, filtmeta, list) if not listname then return end + for i = 1, #list do local item = list[i] if not item:is_empty() then @@ -596,9 +598,14 @@ core.register_lbm({ action = function(pos, node) local meta = core.get_meta(pos) local list = meta:get_inventory():get_list("main") + if not list then + return + end + if put_to_inputinv(pos, node, meta, list) then return end + pos.y = pos.y + 1 for i = 1, #list do local item = list[i] @@ -608,3 +615,4 @@ core.register_lbm({ end end, }) +