mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 08:12:56 +08:00
Pre-check for divisor zero and add explanation
This commit is contained in:
parent
8cca12da64
commit
10bdb7240f
@ -12,6 +12,7 @@ using osu.Framework.Extensions.Color4Extensions;
|
|||||||
using osu.Framework.Extensions.LocalisationExtensions;
|
using osu.Framework.Extensions.LocalisationExtensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Utils;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
@ -192,10 +193,13 @@ namespace osu.Game.Screens.Ranking.Statistics
|
|||||||
[CanBeNull]
|
[CanBeNull]
|
||||||
private Drawable[] createAttributeRow(PerformanceDisplayAttribute attribute, PerformanceDisplayAttribute perfectAttribute)
|
private Drawable[] createAttributeRow(PerformanceDisplayAttribute attribute, PerformanceDisplayAttribute perfectAttribute)
|
||||||
{
|
{
|
||||||
float percentage = (float)(attribute.Value / perfectAttribute.Value);
|
// Don't display the attribute if its maximum is 0
|
||||||
if (float.IsNaN(percentage))
|
// For example, flashlight bonus would be zero if flashlight mod isn't on
|
||||||
|
if (Precision.AlmostEquals(perfectAttribute.Value, 0f))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
float percentage = (float)(attribute.Value / perfectAttribute.Value);
|
||||||
|
|
||||||
return new Drawable[]
|
return new Drawable[]
|
||||||
{
|
{
|
||||||
new OsuSpriteText
|
new OsuSpriteText
|
||||||
|
Loading…
Reference in New Issue
Block a user