aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar ks129 <[email protected]>2021-02-08 16:47:58 +0200
committerGravatar ks129 <[email protected]>2021-02-08 16:47:58 +0200
commitc7711d4d14cfb8bd99ab066bf53ed5ef6efe6a9c (patch)
tree5d78bf8299d6cf14c8a4f4b8b97f67d56bb20e17
parentSimplify if check (diff)
Add nullability check for ref
-rw-r--r--src/pages/FormPage.tsx2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/pages/FormPage.tsx b/src/pages/FormPage.tsx
index 0023db4..e8d1a4b 100644
--- a/src/pages/FormPage.tsx
+++ b/src/pages/FormPage.tsx
@@ -221,7 +221,7 @@ function FormPage(): JSX.Element {
if (invalidFieldIds.length) {
const firstErrored = questions[invalidFieldIds[0]];
- if (firstErrored) {
+ if (firstErrored && firstErrored.props.scroll_ref) {
firstErrored.props.scroll_ref.current.scrollIntoView({ behavior: "smooth", block: "center" });
}
return;