mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 10:33:30 +08:00
Ensure PerformanceBreakdown
pieces cannot be null
This commit is contained in:
parent
9cba24e32c
commit
6edaf4f230
@ -1,8 +1,6 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace osu.Game.Rulesets.Difficulty
|
||||
{
|
||||
/// <summary>
|
||||
@ -19,5 +17,16 @@ namespace osu.Game.Rulesets.Difficulty
|
||||
/// Performance of a perfect play for comparison.
|
||||
/// </summary>
|
||||
public PerformanceAttributes PerfectPerformance { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Create a new performance breakdown.
|
||||
/// </summary>
|
||||
/// <param name="performance">Actual gameplay performance.</param>
|
||||
/// <param name="perfectPerformance">Performance of a perfect play for comparison.</param>
|
||||
public PerformanceBreakdown(PerformanceAttributes performance, PerformanceAttributes perfectPerformance)
|
||||
{
|
||||
Performance = performance;
|
||||
PerfectPerformance = perfectPerformance;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ namespace osu.Game.Rulesets.Difficulty
|
||||
getPerfectPerformance(score, cancellationToken)
|
||||
).ConfigureAwait(false);
|
||||
|
||||
return new PerformanceBreakdown { Performance = performanceArray[0], PerfectPerformance = performanceArray[1] };
|
||||
return new PerformanceBreakdown(performanceArray[0] ?? new PerformanceAttributes(), performanceArray[1] ?? new PerformanceAttributes());
|
||||
}
|
||||
|
||||
[ItemCanBeNull]
|
||||
|
Loading…
Reference in New Issue
Block a user