Skip to content

Commit

Permalink
Merge pull request #2429 from erri120/fix/exception-on-remove
Browse files Browse the repository at this point in the history
Exit early when Loadout doesn't exist anymore
  • Loading branch information
erri120 authored Jan 6, 2025
2 parents d6775ea + 06bc860 commit 9dc0ec6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/NexusMods.DataModel/Diagnostics/DiagnosticManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,12 @@ public IObservable<Diagnostic[]> GetLoadoutDiagnostics(LoadoutId loadoutId)
{
var db = _connection.Db;
var loadout = Loadout.Load(db, loadoutId);
if (!loadout.IsValid()) return [];

try
{
// TODO: cancellation token
// TODO: optimize this a bit so we don't load the model twice, we have the datoms above, we should
// be able to use them
// TODO: optimize this a bit so we don't load the model twice, we have the datoms above, we should be able to use them

var cancellationToken = CancellationToken.None;
return await GetLoadoutDiagnostics(loadout, cancellationToken);
Expand All @@ -70,6 +71,7 @@ public IObservable<Diagnostic[]> GetLoadoutDiagnostics(LoadoutId loadoutId)
return connectableObservable;
}
}

private async Task<Diagnostic[]> GetLoadoutDiagnostics(Loadout.ReadOnly loadout, CancellationToken cancellationToken)
{
var diagnosticEmitters = loadout.InstallationInstance.GetGame().DiagnosticEmitters;
Expand Down

0 comments on commit 9dc0ec6

Please sign in to comment.