logic error for hiddenColumns._syncOrder ?

error happens when j == cols.length - 1 and cols[j].hidden = true
c will be null when j = cols.length