From d36945f6e2d6ae1bcd14bf58b74c70ca076524dd Mon Sep 17 00:00:00 2001 From: Andrea Bogazzi Date: Wed, 15 Jul 2015 15:57:27 +0200 Subject: [PATCH] Update path.class.js --- src/shapes/path.class.js | 10 +++++----- test/unit/path.js | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/shapes/path.class.js b/src/shapes/path.class.js index cac505e1c0a..6adcb1851bd 100644 --- a/src/shapes/path.class.js +++ b/src/shapes/path.class.js @@ -78,7 +78,7 @@ this.setOptions(options); if (!path) { - throw new Error('`path` argument is required'); + path = [ ]; } var fromArray = _toString.call(path) === '[object Array]'; @@ -888,10 +888,10 @@ aY.push(y); } - var minX = min(aX), - minY = min(aY), - maxX = max(aX), - maxY = max(aY), + var minX = min(aX) || 0, + minY = min(aY) || 0, + maxX = max(aX) || 0, + maxY = max(aY) || 0, deltaX = maxX - minX, deltaY = maxY - minY, diff --git a/test/unit/path.js b/test/unit/path.js index f3ea408f419..5f6a50d5c34 100644 --- a/test/unit/path.js +++ b/test/unit/path.js @@ -70,7 +70,7 @@ error = err; } - ok(error, 'should throw error'); + ok(typeof error === 'undefined', 'should not throw error on empty path'); start(); }); });