From b50b69b7ffd54dc0c190e3d64d9e38dc880986b9 Mon Sep 17 00:00:00 2001 From: zombiej Date: Tue, 18 Aug 2020 11:58:49 +0800 Subject: [PATCH] fix: Check if something collection node not exist --- src/TabNavList/index.tsx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) 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; });