Skip to content

Commit

Permalink
Merge pull request #32 from Windows10CE/move-updater-check
Browse files Browse the repository at this point in the history
Fix using Model after update ends
  • Loading branch information
HerpDerpinstine authored Nov 21, 2024
2 parents 0af97c3 + 9d37797 commit 3bf2ea6
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 3bf2ea6

Please sign in to comment.