From 72306e8757fb158aa0ef28c548611bc61d5ef5f9 Mon Sep 17 00:00:00 2001 From: Shadoxfix Date: Fri, 17 Feb 2017 17:36:00 +0100 Subject: [PATCH 1/2] Fix beatmap import crash when the first timingPoint starts later than a slider --- osu.Game/Beatmaps/Beatmap.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/Beatmap.cs b/osu.Game/Beatmaps/Beatmap.cs index d0ce290bad..cd99710db2 100644 --- a/osu.Game/Beatmaps/Beatmap.cs +++ b/osu.Game/Beatmaps/Beatmap.cs @@ -39,6 +39,7 @@ namespace osu.Game.Beatmaps ControlPoint timingPoint = null; foreach (var controlPoint in ControlPoints) + { if (controlPoint.Time <= time) { if (controlPoint.TimingChange) @@ -48,7 +49,15 @@ namespace osu.Game.Beatmaps } else overridePoint = controlPoint; } - else break; + else if (timingPoint == null && controlPoint.TimingChange) + { + timingPoint = controlPoint; + } + else + { + break; + } + } return timingPoint; } From 7a45ea58b2fbe5177c90966d58e8e89abdb5367a Mon Sep 17 00:00:00 2001 From: Shadoxfix Date: Fri, 17 Feb 2017 18:17:18 +0100 Subject: [PATCH 2/2] Add comment explaining why the branch is necessary --- osu.Game/Beatmaps/Beatmap.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Beatmaps/Beatmap.cs b/osu.Game/Beatmaps/Beatmap.cs index cd99710db2..af55caf3b7 100644 --- a/osu.Game/Beatmaps/Beatmap.cs +++ b/osu.Game/Beatmaps/Beatmap.cs @@ -49,6 +49,8 @@ namespace osu.Game.Beatmaps } else overridePoint = controlPoint; } + // Some beatmaps have the first timingPoint (accidentally) start after the first HitObject(s). + // This branch makes it so that the first ControlPoint that makes a timing change is used as the timingPoint for the HitObject(s). else if (timingPoint == null && controlPoint.TimingChange) { timingPoint = controlPoint;