1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 06:42:54 +08:00

Fix beatmap overlay leaderboard not handling null PP scores properly

This commit is contained in:
Salman Ahmed 2022-07-24 04:19:26 +03:00
parent 2205e0dc3d
commit 7c477e6f22

View File

@ -6,7 +6,6 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Extensions;
@ -178,10 +177,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
}
if (showPerformancePoints)
{
Debug.Assert(score.PP != null);
content.Add(new StatisticText(score.PP.Value, format: @"N0"));
}
content.Add(new StatisticText(score.PP, format: @"N0"));
content.Add(new ScoreboardTime(score.Date, text_size)
{
@ -222,19 +218,19 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
private class StatisticText : OsuSpriteText, IHasTooltip
{
private readonly double count;
private readonly double? count;
private readonly double? maxCount;
private readonly bool showTooltip;
public LocalisableString TooltipText => maxCount == null || !showTooltip ? string.Empty : $"{count}/{maxCount}";
public StatisticText(double count, double? maxCount = null, string format = null, bool showTooltip = true)
public StatisticText(double? count, double? maxCount = null, string format = null, bool showTooltip = true)
{
this.count = count;
this.maxCount = maxCount;
this.showTooltip = showTooltip;
Text = count.ToLocalisableString(format);
Text = count?.ToLocalisableString(format) ?? default;
Font = OsuFont.GetFont(size: text_size);
}