From a1fe7663d7135b5eae16278dc6e25fcce7156d48 Mon Sep 17 00:00:00 2001 From: Joep Meindertsma Date: Mon, 15 Nov 2021 21:05:31 +0100 Subject: [PATCH] Prevent error on empty search enter --- data-browser/src/routes/SearchRoute.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data-browser/src/routes/SearchRoute.tsx b/data-browser/src/routes/SearchRoute.tsx index e33bf83f7..42b5e207d 100644 --- a/data-browser/src/routes/SearchRoute.tsx +++ b/data-browser/src/routes/SearchRoute.tsx @@ -29,7 +29,7 @@ export function Search(): JSX.Element { e => { e.preventDefault(); const subject = - htmlElRef.current.children[selectedIndex].getAttribute('about'); + htmlElRef?.current?.children[selectedIndex]?.getAttribute('about'); if (subject) { //@ts-ignore blur does exist though document?.activeElement?.blur();