diff --git a/src/path/Path.js b/src/path/Path.js index 1d3d5074..2434f9bd 100644 --- a/src/path/Path.js +++ b/src/path/Path.js @@ -2672,7 +2672,11 @@ statics: { // Calculate the corner points of butt and square caps var point = segment._point, loc = segment.getLocation(), - normal = loc.getNormal().normalize(radius); + normal; + if (!loc) { + return; + } + normal = loc.getNormal().normalize(radius); if (area) { addPoint(point.subtract(normal)); addPoint(point.add(normal)); diff --git a/test/tests/Path_Bounds.js b/test/tests/Path_Bounds.js index 4e18d1b8..69e32646 100644 --- a/test/tests/Path_Bounds.js +++ b/test/tests/Path_Bounds.js @@ -74,6 +74,14 @@ test('path.strokeBounds on path without stroke', function() { compareRectangles(path.strokeBounds, { x: 121, y: 275.068, width: 149.49305, height: 145.87682 }); }); +test('path.strokeBounds on path with single segment and stroke color', function() { + var path = new Path([ + new Segment(new Point(121, 334), new Point(-19, 38), new Point(30.7666015625, -61.53369140625)) + ]); + path.style.strokeColor = 'black'; + compareRectangles(path.strokeBounds, { x: 121, y: 334, width: 0, height: 0 }); +}); + test('path.bounds & path.strokeBounds with stroke styles', function() { function makePath() { var path = new Path();