Fix 2 crashes

This commit is contained in:
MrRar 2024-11-16 08:39:31 -06:00
parent 2eb1728d8b
commit a56b8dc3ff
2 changed files with 4 additions and 3 deletions

View File

@ -80,8 +80,8 @@ local function on_place(itemstack, player, pointed_thing)
end
end
if selected_item then
local pos = edit.pointed_thing_to_pos(pointed_thing)
if selected_item and pos then
edit.place_item_like_player(player, {name = selected_item}, pos)
end
end

View File

@ -226,11 +226,12 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
local pos = vector.new(x, y, z)
local node = minetest.get_node(pos)
local old_name = node.name
node.name = item_string
if replace_source_nodes[old_name] then
if is_node then
node.name = name
minetest.swap_node(pos, node)
else
node.name = item_string
edit.place_item_like_player(player, node, pos)
end
end