From 520fd773fbc06d896f4e13dce419aff03fce4456 Mon Sep 17 00:00:00 2001 From: seventeenthShulker Date: Mon, 16 Oct 2023 22:07:52 +0200 Subject: [PATCH] Fix random crash when piston breaks node with no player --- mods/HUD/mcl_inventory/creative.lua | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/mods/HUD/mcl_inventory/creative.lua b/mods/HUD/mcl_inventory/creative.lua index bb2f226a2..5dfc2b7ae 100644 --- a/mods/HUD/mcl_inventory/creative.lua +++ b/mods/HUD/mcl_inventory/creative.lua @@ -741,12 +741,14 @@ if minetest.is_creative_enabled("") then for _, item in ipairs(drops) do minetest.add_item(pos, item) end - end - local inv = digger:get_inventory() - if inv then - for _, item in ipairs(drops) do - if not inv:contains_item("main", item, true) then - inv:add_item("main", item) + else + -- If there is a player + local inv = digger:get_inventory() + if inv then + for _, item in ipairs(drops) do + if not inv:contains_item("main", item, true) then + inv:add_item("main", item) + end end end end