From a00c8c978f15d5efbd507c494493654ff630f6f5 Mon Sep 17 00:00:00 2001 From: Benoit Nau Date: Mon, 14 Aug 2023 11:37:34 +0200 Subject: [PATCH] fix: null reference The property searchTerm could be null. Changelog: fixed --- components/search/search.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/search/search.tsx b/components/search/search.tsx index 3de3e54de7..44a69c5a65 100644 --- a/components/search/search.tsx +++ b/components/search/search.tsx @@ -251,7 +251,9 @@ const Search: React.FC = (props: Props): JSX.Element => { } else if (indexChangedViaKeyPress) { e.preventDefault(); setKeepInputFocused(true); - handleAddSearchTerm(visibleSearchHintOptions[highlightedSearchHintIndex].searchTerm); + if (visibleSearchHintOptions[highlightedSearchHintIndex]?.searchTerm) { + handleAddSearchTerm(visibleSearchHintOptions[highlightedSearchHintIndex].searchTerm); + } } if (props.isMentionSearch) {