1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-15 14:33:01 +08:00

Add current screen checks for added safety

This commit is contained in:
Dan Balasescu 2022-03-10 20:02:58 +09:00
parent 2d135e5be6
commit 885cb3ce5b

View File

@ -10,6 +10,7 @@ using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Logging;
using osu.Framework.Screens;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online.Multiplayer;
using osu.Game.Online.Rooms;
@ -171,6 +172,9 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
private void onMatchStarted() => Scheduler.Add(() =>
{
if (!this.IsCurrentScreen())
return;
loadingDisplay.Hide();
base.StartGameplay();
});
@ -179,7 +183,13 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
{
// Schedule is required to ensure that `TaskCompletionSource.SetResult` is not called more than once.
// A scenario where this can occur is if this instance is not immediately disposed (ie. async disposal queue).
Schedule(() => resultsReady.SetResult(true));
Schedule(() =>
{
if (!this.IsCurrentScreen())
return;
resultsReady.SetResult(true);
});
}
protected override async Task PrepareScoreForResultsAsync(Score score)