From 841a0339836d2e57be62d1a71c35739d9205ba79 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein <54945686+EliasFleckenstein03@users.noreply.github.com> Date: Wed, 26 Aug 2020 10:13:25 +0200 Subject: [PATCH] Add nil check in doors_toggle (#126) Add nil check to prevent errors xdecor caused in combination with pkarcs_doors. --- src/mechanisms.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mechanisms.lua b/src/mechanisms.lua index e453229..0a3bcfd 100644 --- a/src/mechanisms.lua +++ b/src/mechanisms.lua @@ -9,7 +9,8 @@ local function door_toggle(pos_actuator, pos_door, player) local player_name = player:get_player_name() local actuator = minetest.get_node(pos_actuator) local door = doors.get(pos_door) - + if not door then return end + if actuator.name:sub(-4) == "_off" then minetest.set_node(pos_actuator, {name = actuator.name:gsub("_off", "_on"), param2 = actuator.param2})