Crash for dropper failing as potentially cannot get pos.

This commit is contained in:
ancientmarinerdev 2023-03-24 23:16:12 +00:00 committed by Gitea
parent 049406162e
commit b72dbf17a6
2 changed files with 5 additions and 0 deletions

View File

@ -99,6 +99,7 @@ local dropperdef = {
mesecons = {effector = { mesecons = {effector = {
-- Drop random item when triggered -- Drop random item when triggered
action_on = function(pos, node) action_on = function(pos, node)
if not pos then return end
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local inv = meta:get_inventory() local inv = meta:get_inventory()
local droppos local droppos

View File

@ -278,6 +278,10 @@ end
local old_add_item = minetest.add_item local old_add_item = minetest.add_item
function minetest.add_item(pos, stack) function minetest.add_item(pos, stack)
if not pos then
minetest.log("warning", "Trying to add item with missing pos: " .. tostring(stack))
return
end
stack = ItemStack(stack) stack = ItemStack(stack)
if get_item_group(stack:get_name(), "filled_map") > 0 then if get_item_group(stack:get_name(), "filled_map") > 0 then
stack:set_name("mcl_maps:filled_map") stack:set_name("mcl_maps:filled_map")