summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Jonas <mjonas@nerdery.com>2013-12-02 21:48:30 -0600
committerMatt Jonas <mjonas@nerdery.com>2013-12-02 21:48:30 -0600
commite6e2f88f832742c44e0fabf1f3864e5176386033 (patch)
treee7363f71b6be643163139e26e08b727cd99a3ec1
parent97321dda9caab37920a9e30ac8d0b5b7e1a1ff42 (diff)
downloadSlickGrid-e6e2f88f832742c44e0fabf1f3864e5176386033.zip
SlickGrid-e6e2f88f832742c44e0fabf1f3864e5176386033.tar.gz
SlickGrid-e6e2f88f832742c44e0fabf1f3864e5176386033.tar.bz2
Fixed steps in autoSizeColumns() that detects infinite loops for shrink and grow operations. In some cases the prevTotal exceeded total (for grow) and was less than total (for shrink). The existing check simply checked if the 2 values were equal, but not if prevTotal had gone beyond the proper bounds, resulting in an infinite loop.
-rw-r--r--slick.grid.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/slick.grid.js b/slick.grid.js
index 7b3c009..c12bae9 100644
--- a/slick.grid.js
+++ b/slick.grid.js
@@ -1061,7 +1061,7 @@ if (typeof Slick === "undefined") {
shrinkLeeway -= shrinkSize;
widths[i] -= shrinkSize;
}
- if (prevTotal == total) { // avoid infinite loop
+ if (prevTotal <= total) { // avoid infinite loop
break;
}
prevTotal = total;
@@ -1084,7 +1084,7 @@ if (typeof Slick === "undefined") {
total += growSize;
widths[i] += growSize;
}
- if (prevTotal == total) { // avoid infinite loop
+ if (prevTotal >= total) { // avoid infinite loop
break;
}
prevTotal = total;