Skip to content

Commit

Permalink
Don't crash on on-of-bounds point index
Browse files Browse the repository at this point in the history
  • Loading branch information
justvanrossum committed Nov 27, 2024
1 parent 9abce6c commit 1878981
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/fontra/views/editor/edit-behavior.js
Original file line number Diff line number Diff line change
@@ -577,7 +577,11 @@ function unpackContours(path, selectedPointIndices) {
// when no points from this contour are selected, or an object with contour info,
const contours = new Array(path.contourInfo.length);
let contourIndex = 0;
const numPoints = path.numPoints;
for (const pointIndex of selectedPointIndices) {
if (pointIndex >= numPoints) {
break;
}
while (path.contourInfo[contourIndex].endPoint < pointIndex) {
contourIndex++;
}

0 comments on commit 1878981

Please sign in to comment.