From 15e9915da6c2adcba0b609f57953eb49f0b5627f Mon Sep 17 00:00:00 2001 From: Jake Fink Date: Fri, 11 Feb 2022 13:46:17 -0500 Subject: [PATCH] check email for null before authenticating (#1769) * check email for null before authenticating * add return after logging out and track error if email not found --- src/App/Pages/Accounts/LockPageViewModel.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/App/Pages/Accounts/LockPageViewModel.cs b/src/App/Pages/Accounts/LockPageViewModel.cs index 084b045fa..c2e48b771 100644 --- a/src/App/Pages/Accounts/LockPageViewModel.cs +++ b/src/App/Pages/Accounts/LockPageViewModel.cs @@ -10,6 +10,9 @@ using Bit.Core.Models.Domain; using Bit.Core.Models.Request; using Bit.Core.Utilities; using Xamarin.Forms; +#if !FDROID +using Microsoft.AppCenter.Crashes; +#endif namespace Bit.App.Pages { @@ -137,8 +140,17 @@ namespace Bit.App.Pages if (_usingKeyConnector && !(BiometricLock || PinLock)) { await _vaultTimeoutService.LogOutAsync(); + return; } _email = await _userService.GetEmailAsync(); + if (string.IsNullOrWhiteSpace(_email)) + { + await _vaultTimeoutService.LogOutAsync(); +#if !FDROID + Crashes.TrackError(new NullReferenceException("Email not found in storage")); +#endif + return; + } var webVault = _environmentService.GetWebVaultUrl(); if (string.IsNullOrWhiteSpace(webVault)) {