Fix index out of range possibility

This commit is contained in:
Naxess 2021-04-08 11:46:00 +02:00
parent 0341023d13
commit be4520fe33

View File

@ -167,13 +167,13 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
switch (type)
{
case PathType.PerfectCurve:
if (piece.PointsInSegment.Count > 3)
{
// Can't always create a circular arc out of 4 or more points,
// so we split the segment into one 3-point circular arc segment
// and one bezier segment.
piece.PointsInSegment[indexInSegment + 2].Type.Value = PathType.Bezier;
}
// Can't always create a circular arc out of 4 or more points,
// so we split the segment into one 3-point circular arc segment
// and one bezier segment.
int thirdPointIndex = indexInSegment + 2;
if (piece.PointsInSegment.Count > thirdPointIndex + 1)
piece.PointsInSegment[thirdPointIndex].Type.Value = PathType.Bezier;
break;
}