fix(virtual-scroll): don't crash with an empty cell list (#17799)

This commit is contained in:
Walt Woods
2019-06-11 08:00:25 -07:00
committed by Brandy Carney
parent 8d2a47e881
commit 20c146e1e5

View File

@ -181,7 +181,7 @@ export function getShouldUpdate(dirtyIndex: number, currentRange: Range, range:
} }
export function findCellIndex(cells: Cell[], index: number): number { export function findCellIndex(cells: Cell[], index: number): number {
const max = cells[cells.length - 1].index || 0; const max = cells.length > 0 ? cells[cells.length - 1].index : 0;
if (index === 0) { if (index === 0) {
return 0; return 0;
} else if (index === max + 1) { } else if (index === max + 1) {