Skip to content

Commit

Permalink
Fixed steps in autoSizeColumns() that detects infinite loops for shri…
Browse files Browse the repository at this point in the history
…nk 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.
  • Loading branch information
Matt Jonas committed Dec 3, 2013
1 parent 97321dd commit e6e2f88
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions slick.grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit e6e2f88

Please sign in to comment.