From 59b84bb07e263e00e17a4596d0cbc57b82065bd3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Oskari=20V=C3=A4ist=C3=B6?= <oskari.vaisto@csc.fi>
Date: Tue, 29 Oct 2024 14:57:58 +0200
Subject: [PATCH] fix(c-select): Prevent errors in the log on component load

---
 packages/csc-ui/src/components/c-select/c-select.tsx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/packages/csc-ui/src/components/c-select/c-select.tsx b/packages/csc-ui/src/components/c-select/c-select.tsx
index 68844e9..21f9c59 100644
--- a/packages/csc-ui/src/components/c-select/c-select.tsx
+++ b/packages/csc-ui/src/components/c-select/c-select.tsx
@@ -358,11 +358,11 @@ export class CSelect {
       this._selectionElement.replaceChildren(clone);
     }
 
-    this._dropdownElement.updateList();
+    this._dropdownElement?.updateList();
 
     this._preventDialogOpen = true;
 
-    this._inputElement.focus();
+    this._inputElement?.focus();
   }
 
   private _setValue({ value, name }: { value: string; name: string }) {