Skip to content

Commit

Permalink
Handle cancellation at more points during Player initialisation
Browse files Browse the repository at this point in the history
As discussed in discord, this will help avoid null references during
cancellation which can otherwise be quite confusing to debug.
  • Loading branch information
peppy committed Aug 9, 2022
1 parent d59f472 commit a508182
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions osu.Game/Screens/Play/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,9 @@ private void load(AudioManager audio, OsuConfigManager config, OsuGameBase game,
// this is intentionally done in two stages to ensure things are in a loaded state before exposing the ruleset to skin sources.
GameplayClockContainer.Add(rulesetSkinProvider);

if (cancellationToken.IsCancellationRequested)
return;

rulesetSkinProvider.AddRange(new Drawable[]
{
failAnimationLayer = new FailAnimation(DrawableRuleset)
Expand Down Expand Up @@ -279,6 +282,9 @@ private void load(AudioManager audio, OsuConfigManager config, OsuGameBase game,
},
});

if (cancellationToken.IsCancellationRequested)
return;

if (Configuration.AllowRestart)
{
rulesetSkinProvider.Add(new HotkeyRetryOverlay
Expand Down

0 comments on commit a508182

Please sign in to comment.