Fix potentially invalid push in player while already exiting

This commit is contained in:
Dean Herbert
2020-03-19 14:10:54 +09:00
parent 3861a92422
commit 17c3455b36

View File

@ -387,6 +387,10 @@ namespace osu.Game.Screens.Play
private void onCompletion() private void onCompletion()
{ {
// screen may be in the exiting transition phase.
if (!this.IsCurrentScreen())
return;
// Only show the completion screen if the player hasn't failed // Only show the completion screen if the player hasn't failed
if (HealthProcessor.HasFailed || completionProgressDelegate != null) if (HealthProcessor.HasFailed || completionProgressDelegate != null)
return; return;
@ -581,7 +585,7 @@ namespace osu.Game.Screens.Play
if (completionProgressDelegate != null && !completionProgressDelegate.Cancelled && !completionProgressDelegate.Completed) if (completionProgressDelegate != null && !completionProgressDelegate.Cancelled && !completionProgressDelegate.Completed)
{ {
// proceed to result screen if beatmap already finished playing // proceed to result screen if beatmap already finished playing
scheduleGotoRanking(); completionProgressDelegate.RunTask();
return true; return true;
} }
@ -623,7 +627,12 @@ namespace osu.Game.Screens.Play
{ {
var score = CreateScore(); var score = CreateScore();
if (DrawableRuleset.ReplayScore == null) if (DrawableRuleset.ReplayScore == null)
scoreManager.Import(score).ContinueWith(_ => Schedule(() => this.Push(CreateResults(score)))); scoreManager.Import(score).ContinueWith(_ => Schedule(() =>
{
// screen may be in the exiting transition phase.
if (this.IsCurrentScreen())
this.Push(CreateResults(score));
}));
else else
this.Push(CreateResults(score)); this.Push(CreateResults(score));
}); });