This commit is contained in:
2025-01-09 03:10:11 +09:00
parent 292870bf8c
commit b56b53c268

View File

@@ -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 <core/lualib/event_handler.lua:45>
]]
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