Skip to content

Commit

Permalink
fix: null check
Browse files Browse the repository at this point in the history
  • Loading branch information
tienifr committed Jul 5, 2023
1 parent cc4ce9b commit fd2e29a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ function BaseTwoFactorAuthForm(props) {
* Check that all the form fields are valid, then trigger the submit callback
*/
const validateAndSubmitForm = useCallback(() => {
inputRef.current.blur();
if (inputRef.current) {
inputRef.current.blur();
}
if (!twoFactorAuthCode.trim()) {
setFormError({twoFactorAuthCode: 'twoFactorAuthForm.error.pleaseFillTwoFactorAuth'});
return;
Expand Down
3 changes: 3 additions & 0 deletions src/pages/settings/Security/TwoFactorAuth/VerifyPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ function VerifyPage(props) {
text={props.translate('common.next')}
isLoading={props.account.isLoading}
onPress={() => {
if (!formRef.current) {
return;
}
formRef.current.validateAndSubmitForm();
}}
/>
Expand Down

0 comments on commit fd2e29a

Please sign in to comment.