headerCells[i] is undefined (minified: i[n] is undefined)
headerCells[i] is undefined (minified: i[n] is undefined)

Hello, I'm using v1.10.7 with Scroller v1.2.2. I'm getting the error "headerCells[i] is undefined" when reinitializing a datatable. I know this is the code that throws the error in jquery.datatables.js:
for ( i=0 ; i<visibleColumns.length ; i++ ) {
column = columns[ visibleColumns[i] ];
headerCells[i].style.width = column.sWidthOrig !== null && column.sWidthOrig !== '' ?
_fnStringToCss( column.sWidthOrig ) :
'';
}
Shouldn't this be wrapped in a if (headerCells[i])
like so?
for ( i=0 ; i<visibleColumns.length ; i++ ) {
column = columns[ visibleColumns[i] ];
if (headerCells[i]) {
headerCells[i].style.width = column.sWidthOrig !== null && column.sWidthOrig !== '' ?
_fnStringToCss( column.sWidthOrig ) :
'';
}
}
In my case the final column in visibleColumns
is visibleColumns[9]
, but headerCells[9]
is undefined because headerCells.length == 9
. I don't know why my headerCells and visibleColumns are out of sync--my codebase is very complex, I'm sorry I can't yet provide a simple reproduction of this error--but using the index of one array to reference another's elements is often problematic as it necessitates the rest of the code to perfectly keep those arrays in sync. So I thought I'd ask here as step 1 just in case this really is a bug.
Thanks for all your attentive help.