diff --git a/modules/skottie/src/SkottieValue.cpp b/modules/skottie/src/SkottieValue.cpp index 296ac143c2..dd37a53a5e 100644 --- a/modules/skottie/src/SkottieValue.cpp +++ b/modules/skottie/src/SkottieValue.cpp @@ -133,19 +133,28 @@ bool ValueTraits::FromJSON(const skjson::Value& jv, return false; const auto& ov = jv.as(); - std::vector inPts, // Cubic Bezier "in" control points, relative to vertices. - outPts, // Cubic Bezier "out" control points, relative to vertices. - verts; // Cubic Bezier vertices. - - if (!ParsePointVec(ov["i"], &inPts) || - !ParsePointVec(ov["o"], &outPts) || - !ParsePointVec(ov["v"], &verts) || - inPts.size() != outPts.size() || - inPts.size() != verts.size()) { + std::vector verts, // Cubic Bezier vertices. + inPts, // Cubic Bezier "in" control points, relative to vertices. + outPts; // Cubic Bezier "out" control points, relative to vertices. + if (!ParsePointVec(ov["v"], &verts)) { + // Vertices are required. return false; } + // In/out points are optional. + ParsePointVec(ov["i"], &inPts); + if (!inPts.empty() && inPts.size() != verts.size()) { + return false; + } + inPts.resize(verts.size(), { 0, 0 }); + + ParsePointVec(ov["o"], &outPts); + if (!outPts.empty() && outPts.size() != verts.size()) { + return false; + } + outPts.resize(verts.size(), { 0, 0 }); + v->fVertices.reserve(inPts.size()); for (size_t i = 0; i < inPts.size(); ++i) { v->fVertices.push_back(BezierVertex({inPts[i], outPts[i], verts[i]}));