Skip to content

Commit

Permalink
fix isWithinBar crash when there were less than 2 items in pathSegList (
Browse files Browse the repository at this point in the history
  • Loading branch information
panthony authored and kt3k committed Jul 29, 2019
1 parent e26e92e commit c0a08f1
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 c0a08f1

Please sign in to comment.