Skip to content

Commit

Permalink
Fix using Model after Updater ends
Browse files Browse the repository at this point in the history
  • Loading branch information
Windows10CE committed Nov 21, 2024
1 parent 0af97c3 commit 9d37797
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions MelonLoader.Installer/Views/MainView.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ protected override async void OnDataContextChanged(EventArgs e)
if (Updater.State == Updater.UpdateState.None)
{
Model.Ready = false;
await DoInit();
if (!await DoInit())
{
return;
}
Model.Ready = true;
}

Expand All @@ -44,7 +47,7 @@ protected override async void OnDataContextChanged(EventArgs e)
}
}

private static async Task DoInit()
private static async Task<bool> DoInit()
{
try
{
Expand All @@ -53,14 +56,15 @@ private static async Task DoInit()
if (await checkUpdate is { } updateTask)
{
_ = MainWindow.Instance.HandleUpdate(updateTask);
return;
return false;
}
await otherInit;
}
catch (Exception ex)
{
CrashException(ex);
}
return true;
}

private static void CrashException(Exception ex)
Expand Down

0 comments on commit 9d37797

Please sign in to comment.