From c4ea50412351c7376a8f5f96ef7830e234dcb501 Mon Sep 17 00:00:00 2001 From: ancientmarinerdev Date: Sun, 22 Jan 2023 18:58:25 +0000 Subject: [PATCH] Fix crash when leaves don't have a registered orphan but try to rot --- mods/ITEMS/mcl_core/nodes_trees.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_core/nodes_trees.lua b/mods/ITEMS/mcl_core/nodes_trees.lua index 787faa6d7..0207b4ec1 100644 --- a/mods/ITEMS/mcl_core/nodes_trees.lua +++ b/mods/ITEMS/mcl_core/nodes_trees.lua @@ -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