1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 10:52:53 +08:00

Fix InvalidOperationException when exiting a map at the end

This commit is contained in:
Christine Chen 2021-05-07 20:59:20 -04:00
parent 495eb04e2f
commit 8c564a69ed
2 changed files with 14 additions and 0 deletions

View File

@ -133,6 +133,16 @@ namespace osu.Game.Tests.Visual.Gameplay
AddUntilStep("storyboard ends", () => Player.GameplayClockContainer.GameplayClock.CurrentTime >= currentStoryboardDuration);
}
[Test]
public void TestPerformExitNoOutro()
{
CreateTest(null);
AddStep("disable storyboard", () => LocalConfig.SetValue(OsuSetting.ShowStoryboard, false));
AddUntilStep("completion set by processor", () => Player.ScoreProcessor.HasCompleted.Value);
AddStep("exit via pause", () => Player.ExitViaPause());
AddAssert("score shown", () => Player.IsScoreShown);
}
protected override bool AllowFail => true;
protected override Ruleset CreatePlayerRuleset() => new OsuRuleset();

View File

@ -542,7 +542,11 @@ namespace osu.Game.Screens.Play
// if the score is ready for display but results screen has not been pushed yet (e.g. storyboard is still playing beyond gameplay), then transition to results screen instead of exiting.
if (prepareScoreForDisplayTask != null)
{
completionProgressDelegate?.Cancel();
completionProgressDelegate = null;
updateCompletionState(true);
}
}
this.Exit();