Merge pull request 'Fix crash stripping unregistered block' (#3585) from fix_crash_noddef into master

Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/3585
This commit is contained in:
ancientmarinerdev 2023-03-25 02:14:42 +00:00
commit 9887958e4e

@ -366,7 +366,14 @@ local function make_stripped_trunk(itemstack, placer, pointed_thing)
if pointed_thing.type ~= "node" then return end if pointed_thing.type ~= "node" then return end
local node = minetest.get_node(pointed_thing.under) local node = minetest.get_node(pointed_thing.under)
local noddef = minetest.registered_nodes[minetest.get_node(pointed_thing.under).name] local node_name = minetest.get_node(pointed_thing.under).name
local noddef = minetest.registered_nodes[node_name]
if not noddef then
minetest.log("warning", "Trying to right click with an axe the unregistered node: " .. tostring(node_name))
return
end
if not placer:get_player_control().sneak and noddef.on_rightclick then if not placer:get_player_control().sneak and noddef.on_rightclick then
return minetest.item_place(itemstack, placer, pointed_thing) return minetest.item_place(itemstack, placer, pointed_thing)