From: Majlen Date: Mon, 12 Sep 2016 15:43:49 +0000 (+0200) Subject: Check that setRow is not negative, fixes #644. (#773) X-Git-Tag: v2.0.0~21 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=8cc4108bdb0db5006d794be50d1bbca9558373e9;hp=051a854a82738473230fd1c20b6c9cacb036269d;p=dygraphs.git Check that setRow is not negative, fixes #644. (#773) Synchronization breaks up if this case is not checked. Fix has been proposed in the bugreport. --- diff --git a/src/dygraph.js b/src/dygraph.js index ff3bcb6..3ffc2e6 100644 --- a/src/dygraph.js +++ b/src/dygraph.js @@ -1813,7 +1813,7 @@ Dygraph.prototype.setSelection = function(row, opt_seriesName, opt_locked) { // for. If it is, just use it, otherwise search the array for a point // in the proper place. var setRow = row - this.getLeftBoundary_(setIdx); - if (setRow < points.length && points[setRow].idx == row) { + if (setRow >= 0 && setRow < points.length && points[setRow].idx == row) { var point = points[setRow]; if (point.yval !== null) this.selPoints_.push(point); } else {