From 77917f66f0d03fc40a810e657f1a8633d926d8a8 Mon Sep 17 00:00:00 2001 From: Djorkaeff Alexandre Date: Wed, 8 Jul 2020 13:52:20 -0300 Subject: [PATCH] [FIX] Register crashing when error data is undefined (#2256) Co-authored-by: Diego Mello --- app/views/RegisterView.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/views/RegisterView.js b/app/views/RegisterView.js index 1fe127416..1e0ce2654 100644 --- a/app/views/RegisterView.js +++ b/app/views/RegisterView.js @@ -145,10 +145,12 @@ class RegisterView extends React.Component { await loginRequest({ user: email, password }); } } catch (e) { - if (e.data && e.data.errorType === 'username-invalid') { + if (e.data?.errorType === 'username-invalid') { return loginRequest({ user: email, password }); } - showErrorAlert(e.data.error, I18n.t('Oops')); + if (e.data?.error) { + showErrorAlert(e.data.error, I18n.t('Oops')); + } } this.setState({ saving: false }); }