Fix crash when leaves don't have a registered orphan but try to rot

This commit is contained in:
ancientmarinerdev 2023-01-22 18:58:25 +00:00 committed by Gitea
parent 6d60fb4160
commit c4ea504123
1 changed files with 8 additions and 1 deletions

View File

@ -35,7 +35,14 @@ function mcl_core.update_leaves(pos, oldnode)
-- manually placed leaf nodes have param2
-- set and will never decay automatically
if lnode.param2 == 0 then
minetest.swap_node(lpos, {name = lnode.name .. "_orphan"})
local orphan_name = lnode.name .. "_orphan"
local def = minetest.registered_nodes[orphan_name]
if def then
--minetest.log("Registered: ".. orphan_name)
minetest.swap_node(lpos, {name = orphan_name})
else
--minetest.log("Not registered: ".. orphan_name)
end
end
end
end