LottieSharp icon indicating copy to clipboard operation
LottieSharp copied to clipboard

Curves must have the same number of control points.

Open andyld97 opened this issue 3 years ago • 0 comments

Describe the bug

Using this sample-file leads to an ArgumentOutOfRangeException here https://github.com/ascora/LottieSharp/blob/80d9cf27ccd234d2b23c523f1ad2b0ea2432f07c/LottieSharp/Model/Content/ShapeData.cs#L68

I don't know exactly why the curves don't have the same amount of points, but this json file also works at https://lottiefiles.com/tools/json-editor.

As a fix I changed the line to:

for (var i = Math.Min(Math.Min(shapeData1.Curves.Count, shapeData2.Curves.Count), _curves.Count) - 1; i >= 0; i--)

But I don't really know if this is the correct solution to fix this problem, but at least this prevents the App from crashing and the output looks fine though.

andyld97 avatar May 08 '21 13:05 andyld97