Skip to content

Error when loading battle that ends in defeat #631

@ekolis

Description

@ekolis

Describe the bug
Opening the battle results for a battle that ends in defeat causes a null reference exception.

Steps to reproduce

  1. Open attached savegame
  2. Double click the "Defeat at Wanduk I" battle in the log

Expected behavior
The battle results load.

Actual behavior
Error:

NullReferenceException occurred at 3/2/2026 2:13:20 PM:
System.NullReferenceException: Object reference not set to an instance of an object.
   at FrEee.Extensions.CommonExtensions.<>c__DisplayClass54_0.<ResultFor>b__2(ICombatant c) in /var/mnt/data/Repos/FrEee/FrEee.Core.Domain/Extensions/CommonExtensions.cs:line 1029
   at System.Linq.Enumerable.IEnumerableWhereIterator`1.TryGetFirst(Boolean& found)
   at System.Linq.Enumerable.Concat2Iterator`1.TryGetFirst(Boolean& found)
   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source)
   at FrEee.Extensions.CommonExtensions.ResultFor(IBattle b, Empire emp) in /var/mnt/data/Repos/FrEee/FrEee.Core.Domain/Extensions/CommonExtensions.cs:line 1032
   at FrEee.Extensions.CommonExtensions.NameFor(IBattle b, Empire emp) in /var/mnt/data/Repos/FrEee/FrEee.Core.Domain/Extensions/CommonExtensions.cs:line 698
   at FrEee.UI.WinForms.Forms.BattleResultsForm.Bind() in /var/mnt/data/Repos/FrEee/FrEee.UI.WinForms/Forms/BattleResultsForm.cs:line 97
   at FrEee.UI.WinForms.Forms.BattleResultsForm.Bind(IBattle data) in /var/mnt/data/Repos/FrEee/FrEee.UI.WinForms/Forms/BattleResultsForm.cs:line 45
   at FrEee.UI.WinForms.Forms.BattleResultsForm..ctor(IBattle battle) in /var/mnt/data/Repos/FrEee/FrEee.UI.WinForms/Forms/BattleResultsForm.cs:line 34
   at FrEee.UI.WinForms.Forms.LogForm.lstLog_MouseDoubleClick(Object sender, MouseEventArgs e) in /var/mnt/data/Repos/FrEee/FrEee.UI.WinForms/Forms/LogForm.cs:line 120
   at System.Windows.Forms.ListView.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(HWND hWnd, UInt32 msg, WPARAM wparam, LPARAM lparam)

Screenshots
N/A

Related issues
N/A

Testing plan
???

Additional context
fc2_44_0001.gam.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugNAGOT GICK FEL - Something went wrong!

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions