diff --git a/components/SearchModal/index.tsx b/components/SearchModal/index.tsx index 61d63a82..1b520fef 100644 --- a/components/SearchModal/index.tsx +++ b/components/SearchModal/index.tsx @@ -126,7 +126,7 @@ const SearchModal = (props: Props) => { } } - if (recents.length > 5) recents.pop() + if (recents && recents.length > 5) recents.pop() setCookies(`recent_${props.object}`, recents, { path: '/' }) sendData(result) }