1
0
Fork 0

fix(core): In Path.clean(), initialize cur variable before use.

This commit is contained in:
Benjamin F 2022-12-04 20:19:51 -08:00
parent b86587e36d
commit 491902aca6

View file

@ -177,6 +177,7 @@ Path.prototype.bbox = function () {
*/ */
Path.prototype.clean = function () { Path.prototype.clean = function () {
const ops = [] const ops = []
let cur
for (const i in this.ops) { for (const i in this.ops) {
const op = this.ops[i] const op = this.ops[i]
if (['move', 'close', 'noop'].includes(op.type)) ops.push(op) if (['move', 'close', 'noop'].includes(op.type)) ops.push(op)
@ -186,7 +187,7 @@ Path.prototype.clean = function () {
if (!(op.cp1.sitsRoughlyOn(cur) && op.cp2.sitsRoughlyOn(cur) && op.to.sitsRoughlyOn(cur))) if (!(op.cp1.sitsRoughlyOn(cur) && op.cp2.sitsRoughlyOn(cur) && op.to.sitsRoughlyOn(cur)))
ops.push(ops) ops.push(ops)
} }
const cur = op?.to cur = op?.to
} }
if (ops.length < this.ops.length) this.ops = ops if (ops.length < this.ops.length) this.ops = ops