use ternary expression

This commit is contained in:
Aergwyn 2018-01-18 15:53:53 +01:00
parent 65bac6d31a
commit 56619ae926

View File

@ -15,7 +15,6 @@ using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Game.Overlays.Direct; using osu.Game.Overlays.Direct;
using osu.Framework.Configuration; using osu.Framework.Configuration;
using System;
namespace osu.Game.Overlays.BeatmapSet namespace osu.Game.Overlays.BeatmapSet
{ {
@ -84,7 +83,7 @@ namespace osu.Game.Overlays.BeatmapSet
if (Playing.Value && preview != null) if (Playing.Value && preview != null)
{ {
// prevent negative (potential infinite) width if a track without length was loaded // prevent negative (potential infinite) width if a track without length was loaded
progress.Width = (float)Math.Max(preview.CurrentTime / preview.Length, 0); progress.Width = preview.Length > 0 ? (float)(preview.CurrentTime / preview.Length) : 0f;
} }
} }