Merge pull request #366 from OussamaDanba/slider_timingpoint_fix

Fix beatmap import crash when the first timingPoint starts later than…
This commit is contained in:
Thomas Müller 2017-02-17 18:22:55 +01:00 committed by GitHub
commit 6a58d7ab2a

View File

@ -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,17 @@ namespace osu.Game.Beatmaps
}
else overridePoint = controlPoint;
}
else break;
// 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;
}
else
{
break;
}
}
return timingPoint;
}