From 3fcc71111e3f30ea7f2d98b34632a529506c1ec7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Sch=C3=BCller?= Date: Sun, 18 Nov 2018 17:28:29 +0100 Subject: [PATCH] Fix crash when area is protected This fixes: when an area is protected and someone (who is not allowed) places a torch then lua crashes. --- mt_style.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mt_style.lua b/mt_style.lua index 7c8d565..e41851a 100644 --- a/mt_style.lua +++ b/mt_style.lua @@ -22,7 +22,10 @@ minetest.register_craftitem(":default:torch", { return itemstack end itemstack, retval = minetest.item_place(fakestack, placer, pointed_thing, wdir) - itemstack:set_name("default:torch") + if itemstack then + itemstack:set_name("default:torch") + -- else, ignore - placing not allowed here + end return itemstack end