From 98e87fd5db149bf68f9ed17ea8ad5b28bcb8396d Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sun, 23 Feb 2020 20:37:42 +0100 Subject: [PATCH] mcl_attached: Check if dir is nil --- mods/CORE/mcl_attached/init.lua | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/mods/CORE/mcl_attached/init.lua b/mods/CORE/mcl_attached/init.lua index 45e1e56b03..146cb22514 100644 --- a/mods/CORE/mcl_attached/init.lua +++ b/mods/CORE/mcl_attached/init.lua @@ -7,15 +7,17 @@ minetest.check_single_for_falling = function(pos) local node = minetest.get_node(pos) if minetest.get_item_group(node.name, "attached_node_facedir") ~= 0 then local dir = minetest.facedir_to_dir(node.param2) - local cpos = vector.add(pos, dir) - local cnode = minetest.get_node(cpos) - if minetest.get_item_group(cnode.name, "solid") == 0 then - minetest.remove_node(pos) - local drops = minetest.get_node_drops(node.name, "") - for dr=1, #drops do - minetest.add_item(pos, drops[dr]) + if dir then + local cpos = vector.add(pos, dir) + local cnode = minetest.get_node(cpos) + if minetest.get_item_group(cnode.name, "solid") == 0 then + minetest.remove_node(pos) + local drops = minetest.get_node_drops(node.name, "") + for dr=1, #drops do + minetest.add_item(pos, drops[dr]) + end + ret = true end - ret = true end end