From 5eec031803fad27fee622b9eda6aee7d28a582b6 Mon Sep 17 00:00:00 2001 From: Vincent Date: Wed, 1 Apr 2020 14:13:51 +1100 Subject: [PATCH] Revert fancy code --- ts/components/session/SessionPasswordModal.tsx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/ts/components/session/SessionPasswordModal.tsx b/ts/components/session/SessionPasswordModal.tsx index 441196314..4dcfa6adf 100644 --- a/ts/components/session/SessionPasswordModal.tsx +++ b/ts/components/session/SessionPasswordModal.tsx @@ -44,7 +44,11 @@ export class SessionPasswordModal extends React.Component { public componentDidMount() { setTimeout(() => { - this.passwordInput.current?.focus(); + if (!this.passwordInput.current) { + return; + } + + this.passwordInput.current.focus(); }, 100); } @@ -136,10 +140,14 @@ export class SessionPasswordModal extends React.Component { } private async setPassword(onSuccess: any) { + if (!this.passwordInput.current || !this.passwordInputConfirm.current){ + return; + } + // Trim leading / trailing whitespace for UX - const enteredPassword = String(this.passwordInput.current?.value).trim(); + const enteredPassword = String(this.passwordInput.current.value).trim(); const enteredPasswordConfirm = String( - this.passwordInputConfirm.current?.value + this.passwordInputConfirm.current.value ).trim(); if (enteredPassword.length === 0 || enteredPasswordConfirm.length === 0) {