From 0018b69e4d609cee1f2d4dbc5852c5f250bd052a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Tue, 3 Jan 2017 00:20:10 +0100 Subject: [PATCH] Improve handling of locations with invalid curves in divideLocations() --- src/path/PathItem.Boolean.js | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/path/PathItem.Boolean.js b/src/path/PathItem.Boolean.js index b3cbeaf4..88b8d4fb 100644 --- a/src/path/PathItem.Boolean.js +++ b/src/path/PathItem.Boolean.js @@ -302,19 +302,21 @@ PathItem.inject(new function() { // a change in the cached location values, see above. curve = loc._curve, segment; - if (curve && curve !== prevCurve) { - // This is a new curve, update clearHandles setting. - clearHandles = !curve.hasHandles() - || clearLookup && clearLookup[getId(curve)]; - // Only keep track of information for rescaling within the curve - rescaleLocs = []; - prevTime = null; - } else if (prevTime > tMin) { - // Rescale curve-time when we are splitting the same curve - // multiple times, if splitting was done previously. - loc._time /= prevTime; + if (curve) { + if (curve !== prevCurve) { + // This is a new curve, update clearHandles setting. + clearHandles = !curve.hasHandles() + || clearLookup && clearLookup[getId(curve)]; + // Only keep track of rescaling information within the curve + rescaleLocs = []; + prevTime = null; + } else if (prevTime > tMin) { + // Rescale curve-time when we are splitting the same curve + // multiple times, if splitting was done previously. + loc._time /= prevTime; + } + prevCurve = curve; } - prevCurve = curve; if (exclude) { // Store this excluded location for later rescaling, in case we // divide the same curve further to the left of this location.