From 56619ae926e180bb408a01cabcfe28551236e4de Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Thu, 18 Jan 2018 15:53:53 +0100 Subject: [PATCH] use ternary expression --- osu.Game/Overlays/BeatmapSet/PreviewButton.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/PreviewButton.cs b/osu.Game/Overlays/BeatmapSet/PreviewButton.cs index 87cd6f7af6..4f5a6ba718 100644 --- a/osu.Game/Overlays/BeatmapSet/PreviewButton.cs +++ b/osu.Game/Overlays/BeatmapSet/PreviewButton.cs @@ -15,7 +15,6 @@ using OpenTK; using OpenTK.Graphics; using osu.Game.Overlays.Direct; using osu.Framework.Configuration; -using System; namespace osu.Game.Overlays.BeatmapSet { @@ -84,7 +83,7 @@ namespace osu.Game.Overlays.BeatmapSet if (Playing.Value && preview != null) { // 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; } }