1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 16:52:54 +08:00

Improve fallback conditions

It's possible to create a `PerfectCurve` type path with more than 3 points currently, so this accounts for that.
This commit is contained in:
Naxess 2021-03-22 19:10:56 +01:00
parent 80e7c3aba7
commit 92f713a30e

View File

@ -211,12 +211,10 @@ namespace osu.Game.Rulesets.Objects
// An almost linear arrangement of points results in radius approaching infinity,
// we should prevent that to avoid memory exhaustion when drawing / approximating
if (pathType != PathType.PerfectCurve)
if (pathType != PathType.PerfectCurve || pointsInSegment.Count != 3)
return;
Vector2[] points = pointsInSegment.Select(point => point.Position.Value).ToArray();
if (points.Length < 3)
return;
Vector2 a = points[0];
Vector2 b = points[1];