From a08f8e3f7588d262721adf8176e911fd3bd0cd59 Mon Sep 17 00:00:00 2001 From: Dmitry Lyzo Date: Wed, 16 Feb 2022 21:52:06 +0300 Subject: [PATCH] Fix null reference TypeScript error - searchInput --- src/components/search/SearchFields.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/components/search/SearchFields.tsx b/src/components/search/SearchFields.tsx index 699cf52edf..ed1bd02465 100644 --- a/src/components/search/SearchFields.tsx +++ b/src/components/search/SearchFields.tsx @@ -57,6 +57,11 @@ const SearchFields: FunctionComponent = ({ onSearch = () => { const value = (e as CustomEvent).detail.value; const searchInput = getSearchInput(); + if (!searchInput) { + console.error('Unexpected null reference'); + return; + } + if (value === 'backspace') { const currentValue = searchInput.value; searchInput.value = currentValue.length ? currentValue.substring(0, currentValue.length - 1) : '';