From e0abc7515dcfac5c7f5a04f28d9e9331d2f7c560 Mon Sep 17 00:00:00 2001 From: cora Date: Wed, 14 Sep 2022 14:47:50 +0200 Subject: [PATCH] Prevent possible crashes in creative dig and place --- mods/HUD/mcl_inventory/init.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mods/HUD/mcl_inventory/init.lua b/mods/HUD/mcl_inventory/init.lua index 94110c828f..c8caaab2ce 100644 --- a/mods/HUD/mcl_inventory/init.lua +++ b/mods/HUD/mcl_inventory/init.lua @@ -206,6 +206,7 @@ end --Insta "digging" nodes in gamemode-creative minetest.register_on_punchnode(function(pos, node, puncher, pointed_thing) + if not puncher or not puncher:is_player() then return end if minetest.is_creative_enabled() then return end local name = puncher:get_player_name() if not minetest.is_creative_enabled(name) then return end @@ -220,7 +221,7 @@ end) --Don't subtract from inv when placing in gamemode-creative minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack, pointed_thing) - if minetest.is_creative_enabled(placer:get_player_name()) then return true end + if placer and placer:is_player() and minetest.is_creative_enabled(placer:get_player_name()) then return true end end) local function in_table(n,h)