From e6e2f88f832742c44e0fabf1f3864e5176386033 Mon Sep 17 00:00:00 2001 From: Matt Jonas Date: Mon, 2 Dec 2013 21:48:30 -0600 Subject: [PATCH] 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. --- slick.grid.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/slick.grid.js b/slick.grid.js index 7b3c009c8..c12bae9bb 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;