From f57220f78496f65c58f0e3d2816417d3350cbe50 Mon Sep 17 00:00:00 2001 From: Michieal Date: Wed, 20 Sep 2023 05:57:49 +0000 Subject: [PATCH] Fix Server crash (Issue ##3939) Fixes the error of pointed_thing being nil (null) by first checking to see if it exists, and if not, exit the on_place call back. --- mods/ITEMS/mcl_bamboo/bamboo_base.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_bamboo/bamboo_base.lua b/mods/ITEMS/mcl_bamboo/bamboo_base.lua index 4ccb9bb1b..2cc8b23c8 100644 --- a/mods/ITEMS/mcl_bamboo/bamboo_base.lua +++ b/mods/ITEMS/mcl_bamboo/bamboo_base.lua @@ -86,7 +86,7 @@ local bamboo_def = { on_rotate = on_rotate, on_place = function(itemstack, placer, pointed_thing) - if pointed_thing.type ~= "node" then + if pointed_thing and pointed_thing.type ~= "node" then -- make sure that pointed_thing is not null and is pointing at a node. return itemstack end local node = minetest.get_node(pointed_thing.under) @@ -277,6 +277,10 @@ local bamboo_block_def = { _mcl_stripped_variant = "mcl_bamboo:bamboo_block_stripped", -- this allows us to use the built in Axe's strip block. on_place = function(itemstack, placer, pointed_thing) + if not pointed_thing then -- make sure that pointed_thing is not null + return itemstack + end + local pos = pointed_thing.under if mcl_bamboo.is_protected(pos, placer) then