From a611c0418ed48127fd8c04eaf2c4474a7ee94579 Mon Sep 17 00:00:00 2001 From: Andy Dufilie Date: Thu, 21 Jan 2016 17:27:28 -0500 Subject: [PATCH] fixed getPathBox() crash when there were less than 2 items in pathSegList --- src/util.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/util.js b/src/util.js index e245255..79cb901 100644 --- a/src/util.js +++ b/src/util.js @@ -39,6 +39,9 @@ var isValue = c3_chart_internal_fn.isValue = function (v) { return found; }, getPathBox = c3_chart_internal_fn.getPathBox = function (path) { + if (path.pathSegList.numberOfItems < 2) { + return {x: 0, y: 0, width: 0, height: 0}; + } var box = path.getBoundingClientRect(), items = [path.pathSegList.getItem(0), path.pathSegList.getItem(1)], minX = items[0].x, minY = Math.min(items[0].y, items[1].y);