diff --git a/src/stickyScrollBar.tsx b/src/stickyScrollBar.tsx index a77765405..6963dc17f 100644 --- a/src/stickyScrollBar.tsx +++ b/src/stickyScrollBar.tsx @@ -20,7 +20,7 @@ const StickyScrollBar: React.ForwardRefRenderFunction { const prefixCls = useContext(TableContext, 'prefixCls'); - const bodyScrollWidth = scrollBodyRef.current.scrollWidth || 0; + const bodyScrollWidth = scrollBodyRef.current?.scrollWidth || 0; const bodyWidth = scrollBodyRef.current?.clientWidth || 0; const scrollBarWidth = bodyScrollWidth && bodyWidth * (bodyWidth / bodyScrollWidth);