Skip to content

Fill returning undefined vertices #2

@jhughes2112

Description

@jhughes2112

This tiny fix helps out when passing in a fill that doesn't appear to produce good output.

Stitch.Optimize = {
  joinPolylines: function (polylines, maxJoinDistance) {
-   let joinedPolylines = [polylines[0]];
+   //––– safety: drop falsy / empty polylines and short-circuit if nothing left
+   polylines = polylines.filter(p => p && p.vertices && p.vertices.length);
+   if (polylines.length === 0) return [];
+
+   let joinedPolylines = [polylines[0]];
    let queue = polylines.slice(1);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions