From 5ba1c48589e855ab3143242de0eafe2890589969 Mon Sep 17 00:00:00 2001 From: orwell Date: Wed, 29 Jan 2025 22:17:31 +0100 Subject: Try to narrow down heisenbug with endless loop --- advtrains/occupation.lua | 2 ++ 1 file changed, 2 insertions(+) (limited to 'advtrains/occupation.lua') diff --git a/advtrains/occupation.lua b/advtrains/occupation.lua index 20a986e..66ad36c 100644 --- a/advtrains/occupation.lua +++ b/advtrains/occupation.lua @@ -103,7 +103,9 @@ function o.clear_all_items(train_id, pos) local t = occget(pos) if not t then return end local i = 1 + local _cnt = 0 while t[i] do + _cnt = _cnt + 1; if _cnt > 10000 then error("Loop trap in advtrains.occ,clear_all_items was triggered!") end if t[i]==train_id then table.remove(t, i) table.remove(t, i) -- cgit v1.2.3