diff --git a/src/TabNavList/index.tsx b/src/TabNavList/index.tsx index 4180bbd8..c7ccbcbb 100644 --- a/src/TabNavList/index.tsx +++ b/src/TabNavList/index.tsx @@ -335,12 +335,14 @@ function TabNavList(props: TabNavListProps, ref: React.Ref) { const newSizes: TabSizeMap = new Map(); tabs.forEach(({ key }) => { const btnNode = getBtnRef(key).current; - newSizes.set(key, { - width: btnNode.offsetWidth, - height: btnNode.offsetHeight, - left: btnNode.offsetLeft, - top: btnNode.offsetTop, - }); + if (btnNode) { + newSizes.set(key, { + width: btnNode.offsetWidth, + height: btnNode.offsetHeight, + left: btnNode.offsetLeft, + top: btnNode.offsetTop, + }); + } }); return newSizes; });