From f86cb30e47f07356286829544b7c2a136cc08057 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Wed, 17 Jan 2018 20:35:28 +0100 Subject: [PATCH] prevent negative width on progress bar --- osu.Game/Overlays/BeatmapSet/PreviewButton.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/BeatmapSet/PreviewButton.cs b/osu.Game/Overlays/BeatmapSet/PreviewButton.cs index 11d1769f1e..87cd6f7af6 100644 --- a/osu.Game/Overlays/BeatmapSet/PreviewButton.cs +++ b/osu.Game/Overlays/BeatmapSet/PreviewButton.cs @@ -15,6 +15,7 @@ using OpenTK; using OpenTK.Graphics; using osu.Game.Overlays.Direct; using osu.Framework.Configuration; +using System; namespace osu.Game.Overlays.BeatmapSet { @@ -82,7 +83,8 @@ namespace osu.Game.Overlays.BeatmapSet if (Playing.Value && preview != null) { - progress.Width = (float)(preview.CurrentTime / preview.Length); + // prevent negative (potential infinite) width if a track without length was loaded + progress.Width = (float)Math.Max(preview.CurrentTime / preview.Length, 0); } }