Apply review suggestions.

This commit is contained in:
Lucas A
2020-09-28 19:05:22 +02:00
parent 6efc4c4250
commit 35f7de2084
3 changed files with 11 additions and 7 deletions

View File

@ -25,8 +25,15 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics
[BackgroundDependencyLoader]
private void load(ScorePerformanceManager performanceManager)
{
performanceManager.CalculatePerformanceAsync(score, cancellationTokenSource.Token)
.ContinueWith(t => Schedule(() => performance.Value = (int)t.Result), cancellationTokenSource.Token);
if (score.PP.HasValue)
{
performance.Value = (int)score.PP.Value;
}
else
{
performanceManager.CalculatePerformanceAsync(score, cancellationTokenSource.Token)
.ContinueWith(t => Schedule(() => performance.Value = (int)t.Result), cancellationTokenSource.Token);
}
}
public override void Appear()
@ -37,7 +44,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics
protected override void Dispose(bool isDisposing)
{
cancellationTokenSource.Cancel();
cancellationTokenSource?.Cancel();
base.Dispose(isDisposing);
}
}