Skip to content

Commit

Permalink
fixed isWithinBar() crash when there were less than 2 items in pathSe…
Browse files Browse the repository at this point in the history
…gList
  • Loading branch information
Andy Dufilie authored and panthony committed Jul 26, 2019
1 parent 52edeb5 commit 658330d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/shape.bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ ChartInternal.prototype.generateGetBarPoints = function (barIndices, isSub) {
};
};
ChartInternal.prototype.isWithinBar = function (mouse, that) {
if (that.pathSegList.numberOfItems < 2) {
return false;
}
var box = that.getBoundingClientRect(),
seg0 = that.pathSegList.getItem(0), seg1 = that.pathSegList.getItem(1),
x = Math.min(seg0.x, seg1.x), y = Math.min(seg0.y, seg1.y),
Expand Down

0 comments on commit 658330d

Please sign in to comment.