From 60e34a0767dfe9e65006fd43e137904c478b8f9c Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 9 Jan 2025 06:30:13 +0900 Subject: [PATCH] Add Assert For Issue 352 (#349) * Update module_exports.lua * Update module_exports.lua * Link to issue rather than PR --------- Co-authored-by: Cooldude2606 <25043174+Cooldude2606@users.noreply.github.com> --- exp_util/module/module_exports.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/exp_util/module/module_exports.lua b/exp_util/module/module_exports.lua index a98b1e71..01c14397 100644 --- a/exp_util/module/module_exports.lua +++ b/exp_util/module/module_exports.lua @@ -420,6 +420,16 @@ 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 == nil then + -- See Github Issue #352 + 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