From b3337921a11bd51239118c355b4ae5961292cc0b Mon Sep 17 00:00:00 2001 From: Vanessa Dannenberg Date: Fri, 31 May 2019 08:00:09 -0400 Subject: [PATCH] fix crash (bad variable ref) --- homedecor_electrical/init.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/homedecor_electrical/init.lua b/homedecor_electrical/init.lua index 53c7fbb0..a33451b7 100644 --- a/homedecor_electrical/init.lua +++ b/homedecor_electrical/init.lua @@ -2,9 +2,10 @@ local S = homedecor.gettext function homedecor.toggle_switch(pos, node, clicker, itemstack, pointed_thing) - if minetest.is_protected(pos, clicker:get_player_name()) then - minetest.record_protection_violation(pos, - sender:get_player_name()) + if not clicker then return false end + local playername = clicker:get_player_name() + if minetest.is_protected(pos, playername) then + minetest.record_protection_violation(pos, playername) return false end local sep = string.find(node.name, "_o", -5)