Check that setRow is not negative, fixes #644. (#773)
authorMajlen <majlen@civ.zcu.cz>
Mon, 12 Sep 2016 15:43:49 +0000 (17:43 +0200)
committerDan Vanderkam <danvdk@gmail.com>
Mon, 12 Sep 2016 15:43:49 +0000 (11:43 -0400)
Synchronization breaks up if this case is not checked. Fix has been
proposed in the bugreport.

src/dygraph.js

index ff3bcb6..3ffc2e6 100644 (file)
@@ -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 {