mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 02:02:53 +08:00
Merge pull request #18936 from peppy/fix-nan-diff-calc-result
Guard against `NaN` star difficulty results
This commit is contained in:
commit
68d4676ad0
@ -207,7 +207,7 @@ namespace osu.Game.Beatmaps
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
return;
|
||||
|
||||
var starDifficulty = task.GetResultSafely();
|
||||
StarDifficulty? starDifficulty = task.GetResultSafely();
|
||||
|
||||
if (starDifficulty != null)
|
||||
bindable.Value = starDifficulty.Value;
|
||||
|
@ -34,7 +34,7 @@ namespace osu.Game.Beatmaps
|
||||
/// </summary>
|
||||
public StarDifficulty([NotNull] DifficultyAttributes attributes)
|
||||
{
|
||||
Stars = attributes.StarRating;
|
||||
Stars = double.IsFinite(attributes.StarRating) ? attributes.StarRating : 0;
|
||||
MaxCombo = attributes.MaxCombo;
|
||||
Attributes = attributes;
|
||||
// Todo: Add more members (BeatmapInfo.DifficultyRating? Attributes? Etc...)
|
||||
@ -46,7 +46,7 @@ namespace osu.Game.Beatmaps
|
||||
/// </summary>
|
||||
public StarDifficulty(double starDifficulty, int maxCombo)
|
||||
{
|
||||
Stars = starDifficulty;
|
||||
Stars = double.IsFinite(starDifficulty) ? starDifficulty : 0;
|
||||
MaxCombo = maxCombo;
|
||||
Attributes = null;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user