Avoid dividing with zero while splitting curves

This commit is contained in:
hkrish 2014-03-12 13:34:43 +01:00
parent 9c552b1739
commit 066d47dbf7

View file

@ -212,7 +212,9 @@ PathItem.inject(new function() {
var loc = intersections[i],
t = loc._parameter;
// Check if we are splitting same curve multiple times
if (prevLoc && prevLoc._curve === loc._curve) {
if (prevLoc && prevLoc._curve === loc._curve
// Avoid dividing with zero
&& prevLoc._parameter > 0) {
// Scale parameter after previous split.
t /= prevLoc._parameter;
} else {
@ -663,4 +665,4 @@ CompoundPath.inject(/** @lends CompoundPath# */{
monoCurves.push.apply(monoCurves, children[i]._getMonoCurves());
return monoCurves;
}
});
});