Skip to content

Commit

Permalink
[DataGrid] Fix null reference error in GridVirtualScrollbar (#15009)
Browse files Browse the repository at this point in the history
  • Loading branch information
MBilalShafi committed Nov 5, 2024
1 parent 19d6bce commit 45dc398
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ const GridVirtualScrollbar = React.forwardRef<HTMLDivElement, GridVirtualScrollb

const onScrollerScroll = useEventCallback(() => {
const scroller = apiRef.current.virtualScrollerRef.current!;
const scrollbar = scrollbarRef.current!;
const scrollbar = scrollbarRef.current;
if (!scrollbar) {
return;
}

if (scroller[propertyScroll] === lastPosition.current) {
return;
Expand All @@ -114,7 +117,10 @@ const GridVirtualScrollbar = React.forwardRef<HTMLDivElement, GridVirtualScrollb

const onScrollbarScroll = useEventCallback(() => {
const scroller = apiRef.current.virtualScrollerRef.current!;
const scrollbar = scrollbarRef.current!;
const scrollbar = scrollbarRef.current;
if (!scrollbar) {
return;
}

if (isLocked.current) {
isLocked.current = false;
Expand Down

0 comments on commit 45dc398

Please sign in to comment.