rajko-horvat/OpenCiv1

Repeatable crash in CityWorker.F0_1d12_0045_ProcessCityState

elliotkendall opened this issue · 2 comments

Describe the bug
Fairly late in a game (1909, tech tree complete), I'm seeing increasingly frequent crashes. Was generally possible to reload and play maybe another turn or two before it happened again, but I've now got a 100% repeatable crash.

To Reproduce
Load the attached game. Press S to sentry the Artillery unit in Chapultepec.

Expected behavior
The unit should go into sentry mode and the game should continue.

Screenshots
The log shows:

				Exception message: Index was outside the bounds of the array.
				Exception source: OpenCiv1
				Exception stack trace:    at OpenCiv1.CityWorker.F0_1d12_0045_ProcessCityState(Int16 cityID, Int16 flag) in /Users/ekenda2/OpenCiv1/src/CivGame/Game/CityWorker.cs:line 40
   at OpenCiv1.Segment_1ade.F0_1ade_0006(Int16 playerID) in /Users/ekenda2/OpenCiv1/src/CivGame/Game/Segment_1ade.cs:line 62
   at OpenCiv1.Segment_1238.F0_1238_0092() in /Users/ekenda2/OpenCiv1/src/CivGame/Game/Segment_1238.cs:line 163
   at OpenCiv1.Segment_11a8.F0_11a8_0008_Main() in /Users/ekenda2/OpenCiv1/src/CivGame/Game/Segment_11a8.cs:line 147
   at OpenCiv1.CivGame.Start() in /Users/ekenda2/OpenCiv1/src/CivGame/CivGame.cs:line 1116
   at OpenCiv1.UI.MainWindow.GameThread() in /Users/ekenda2/OpenCiv1/src/UI/MainWindow.axaml.cs:line 544

Desktop (please complete the following information):

  • OpenCiv1 built from source, latest commit 2ae8d81
  • OS: macOS 14.6.1
  • Dotnet 8.0.104 (from homebrew)

.NET SDKs installed:
8.0.104 [/opt/homebrew/Cellar/dotnet/8.0.4/libexec/sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.4 [/opt/homebrew/Cellar/dotnet/8.0.4/libexec/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.4 [/opt/homebrew/Cellar/dotnet/8.0.4/libexec/shared/Microsoft.NETCore.App]
save.zip

Thank you for testing OpenCiv1.

Your bug details help a lot. I will check what the problem is and how to fix it.

I have made a fix for the issue. Please clone the Master and compile with a Debug flag