From a56b8dc3ff1ef409695484dbdc008f835a1c5da9 Mon Sep 17 00:00:00 2001 From: MrRar Date: Sat, 16 Nov 2024 08:39:31 -0600 Subject: [PATCH] Fix 2 crashes --- bag.lua | 4 ++-- replace.lua | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/bag.lua b/bag.lua index ee8f773..4b53e31 100644 --- a/bag.lua +++ b/bag.lua @@ -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) + 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 diff --git a/replace.lua b/replace.lua index 5d99822..a541b2a 100644 --- a/replace.lua +++ b/replace.lua @@ -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