Fix crash with undefined nodes

This commit is contained in:
teknomunk 2024-04-27 07:28:55 +00:00
parent 3705be24d7
commit 6fbe60f1ac

View file

@ -46,7 +46,7 @@ local function straight_hopper_act(pos, node, active_object_count, active_count_
local dst_name = dst_node.name local dst_name = dst_node.name
local dst_def = minetest.registered_nodes[dst_name] local dst_def = minetest.registered_nodes[dst_name]
if dst_def._mcl_hopper_act then if dst_def and dst_def._mcl_hopper_act then
dst_def._mcl_hopper_act( dst_pos, dst_node, active_object_count, active_count_wider ) dst_def._mcl_hopper_act( dst_pos, dst_node, active_object_count, active_count_wider )
end end
@ -78,7 +78,7 @@ local function bent_hopper_act(pos, node, active_object_count, active_object_cou
local dst_node = minetest.get_node(dst_pos) local dst_node = minetest.get_node(dst_pos)
local dst_name = dst_node.name local dst_name = dst_node.name
local dst_def = minetest.registered_nodes[dst_name] local dst_def = minetest.registered_nodes[dst_name]
if dst_def._mcl_hopper_act then if dst_def and dst_def._mcl_hopper_act then
dst_def._mcl_hopper_act( dst_pos, dst_node, active_object_count, active_object_count_wider ) dst_def._mcl_hopper_act( dst_pos, dst_node, active_object_count, active_object_count_wider )
end end
mcl_util.hopper_push(pos, dst_pos) mcl_util.hopper_push(pos, dst_pos)