VirtualScroller: avoid unsafe null access
@@ -209,12 +209,11 @@ export default class VirtualScroller<T> extends Component<VirtualScrollerProps<T
const { visibleItems } = this.state;
if(size !== prevProps.size || pendingSize !== prevProps.pendingSize) {
- if(this.scrollLocked) {
- if(!this.state.visibleItems.peekLargest()![0].eq(this.props.data.peekLargest()![0])) {
+ if(this.scrollLocked && visibleItems?.peekLargest() && data?.peekLargest()) {
+ if(!visibleItems.peekLargest()[0].eq(data.peekLargest()[0])) {
this.updateVisible(0);
}
this.resetScroll();
-
}
}
}
