From 6603f2727989f1a9bba6671c461353b36511ee7d Mon Sep 17 00:00:00 2001 From: Buckaroo Banzai <39065740+BuckarooBanzay@users.noreply.github.com> Date: Thu, 25 Jun 2020 12:11:20 +0200 Subject: [PATCH] controller: Add nil check in for digiline pipeworks injection (#49) Co-authored-by: BuckarooBanzay --- lua/controller.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lua/controller.lua b/lua/controller.lua index df1dfa3..6ae3f44 100644 --- a/lua/controller.lua +++ b/lua/controller.lua @@ -390,7 +390,10 @@ local function controller_on_digiline_receive(pos, _, channel, msg) local taken_stack = drawers.drawer_take_item(drawers_index[item:get_name()]["drawer_pos"], item) local dir = core.facedir_to_dir(core.get_node(pos).param2) - pipeworks.tube_inject_item(pos, pos, dir, taken_stack:to_string()) + -- prevent crash if taken_stack ended up with a nil value + if taken_stack then + pipeworks.tube_inject_item(pos, pos, dir, taken_stack:to_string()) + end end local function controller_on_receive_fields(pos, formname, fields, sender)