diff --git a/modules/HiddenColumns.js b/modules/HiddenColumns.js index be6c6eb5e..06f92640c 100644 --- a/modules/HiddenColumns.js +++ b/modules/HiddenColumns.js @@ -278,10 +278,10 @@ define([ //Sort the cached columns to have the same order as g._columns. for(; i < columns.length && j < cols.length; ++i, ++j){ //j must not overflow here because t._cols and g._columns are synced up. - for(c = cols[j]; c.hidden; c = cols[j]){ + for(c = cols[j]; c && c.hidden; c = cols[j]){ ++j; } - if(columns[i] != c){ + if(c && columns[i] != c){ k = array.indexOf(cols, columns[i]); cols[j] = cols[k]; cols[k] = c;