VirtualScroller: do not crash if ref is unset

This commit is contained in:
Liam Fitzgerald 2021-04-29 14:33:26 +10:00
parent 2705f157c0
commit dbf8c2afb9
No known key found for this signature in database
GPG Key ID: D390E12C61D1CFFB

View File

@ -504,6 +504,11 @@ export default class VirtualScroller<T> extends Component<VirtualScrollerProps<T
this.savedIndex = bottomIndex;
const ref = this.childRefs.get(bottomIndex.toString())!;
if(!ref) {
this.saveDepth--;
log('bail', 'missing ref');
return;
}
const { offsetTop } = ref;
this.savedDistance = topSpacing - offsetTop
}