From b56b53c2689dee3202694fd80f217e4fbd4e8d1f Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 9 Jan 2025 03:10:11 +0900 Subject: [PATCH] . --- exp_util/module/module_exports.lua | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/exp_util/module/module_exports.lua b/exp_util/module/module_exports.lua index dc49b0e4..e66b8622 100644 --- a/exp_util/module/module_exports.lua +++ b/exp_util/module/module_exports.lua @@ -420,7 +420,29 @@ function ExpUtil.get_storage_for_stack(options) local current, count, entities = cache.current, cache.count, cache.entities for i = 1, cache.count do local entity = entities[((current + i - 1) % count) + 1] - if entity and entity.can_insert(item) then + --[[ + PR 349 https://github.com/explosivegaming/ExpCluster/pull/349 + + Error while running event level::on_character_corpse_expired (ID 103) + level/modules/exp_util/module_exports.lua:423: attempt to index local 'entity' (a nil value) + stack traceback: + level/modules/exp_util/module_exports.lua:423: in function 'get_storage_for_stack' + level/modules/exp_util/module_exports.lua:462: in function 'copy_items_to_surface' + level/modules/exp_util/module_exports.lua:495: in function 'transfer_inventory_to_surface' + ...vel__/modules/exp_legacy/modules/addons/death-logger.lua:155: in function 'handler' + level/modules/exp_legacy/utils/event.lua:22: in function 'handler' + core/lualib/event_handler.lua:47: in function + ]] + if entity == nil then + error("entity was nil, context:\n" .. ExpUtil.format_any({ + cache = cache, + i = i, + }, { + max_line_count = 0, + no_locale_strings = true + })) + end + if entity.can_insert(item) then cache.current = current + 1 return entity end