Skip to content

Commit

Permalink
Try to prevent an invalid cast exception during RebootRepair events.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tkael committed Mar 11, 2024
1 parent f951722 commit 2c5d9b4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion DataProviderService/DataProviderService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public void syncFromStarMapService(DateTime? lastSync = null)
}
else
{
Logging.Warn("No flight logs received.");
Logging.Warn("No new flight logs received.");
}
}
catch (EDSMException edsme)
Expand Down
14 changes: 11 additions & 3 deletions JournalMonitor/JournalMonitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3685,12 +3685,20 @@ system.y is decimal sy &&
case "RebootRepair":
{
// This event returns a list of slots rather than actual module ednames.
data.TryGetValue("Modules", out object val);
var slotsJson = (List<string>)val;
List<string> slotsJson = null;
data.TryGetValue( "Modules", out var val );
if ( val is List<string> ls )
{
slotsJson = ls;
}
else if ( val is List<object> lo )
{
slotsJson = lo.Select( o => o.ToString() ).ToList();
}

var ship = EDDI.Instance.CurrentShip;
List<Module> modules = new List<Module>();
foreach (string slot in slotsJson)
foreach (var slot in slotsJson)
{
Module module = null;
if (slot.Contains("CargoHatch"))
Expand Down

0 comments on commit 2c5d9b4

Please sign in to comment.