From 29b2d67fb6c27de51cc06671c3a2f51e67387cff Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Mon, 30 Oct 2017 11:12:14 -0400 Subject: [PATCH] null checks --- src/Android/MainActivity.cs | 4 ++-- src/App/Pages/Vault/VaultListCiphersPage.cs | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Android/MainActivity.cs b/src/Android/MainActivity.cs index 37f7fc606..74ee00cd8 100644 --- a/src/Android/MainActivity.cs +++ b/src/Android/MainActivity.cs @@ -140,14 +140,14 @@ namespace Bit.Android { var isPremium = Resolver.Resolve()?.TokenPremium ?? false; var autoCopyEnabled = !_settings.GetValueOrDefault(Constants.SettingDisableTotpCopy, false); - if(isPremium && autoCopyEnabled && _deviceActionService != null && cipher.LoginTotp.Value != null) + if(isPremium && autoCopyEnabled && _deviceActionService != null && cipher.LoginTotp?.Value != null) { _deviceActionService.CopyToClipboard(App.Utilities.Crypto.Totp(cipher.LoginTotp.Value)); } data.PutExtra("uri", cipher.LoginUri); data.PutExtra("username", cipher.LoginUsername); - data.PutExtra("password", cipher.LoginPassword.Value); + data.PutExtra("password", cipher.LoginPassword?.Value ?? null); } if(Parent == null) diff --git a/src/App/Pages/Vault/VaultListCiphersPage.cs b/src/App/Pages/Vault/VaultListCiphersPage.cs index 1e045dbfa..697cc58e9 100644 --- a/src/App/Pages/Vault/VaultListCiphersPage.cs +++ b/src/App/Pages/Vault/VaultListCiphersPage.cs @@ -218,7 +218,9 @@ namespace Bit.App.Pages { searchFilter = searchFilter.ToLower(); var filteredCiphers = Ciphers - .Where(s => s.Name.ToLower().Contains(searchFilter) || s.Subtitle.ToLower().Contains(searchFilter)) + .Where(s => + s.Name.ToLower().Contains(searchFilter) || + (s.Subtitle?.ToLower().Contains(searchFilter) ?? false)) .TakeWhile(s => !ct.IsCancellationRequested) .ToArray();