From 0dbc23f734ad93d68fc55fc61a8e4482446817ea Mon Sep 17 00:00:00 2001 From: Dinis Vieira Date: Sun, 1 Oct 2023 23:15:55 +0100 Subject: [PATCH] PM-3349 PM-3350 Add null checks on CipherDetailsPageVM to avoid crash opening Secure Notes. --- src/Core/Pages/Vault/CipherDetailsPageViewModel.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Core/Pages/Vault/CipherDetailsPageViewModel.cs b/src/Core/Pages/Vault/CipherDetailsPageViewModel.cs index 4e122993d..bbcf70373 100644 --- a/src/Core/Pages/Vault/CipherDetailsPageViewModel.cs +++ b/src/Core/Pages/Vault/CipherDetailsPageViewModel.cs @@ -149,7 +149,7 @@ namespace Bit.App.Pages public bool IsIdentity => Cipher?.Type == Core.Enums.CipherType.Identity; public bool IsCard => Cipher?.Type == Core.Enums.CipherType.Card; public bool IsSecureNote => Cipher?.Type == Core.Enums.CipherType.SecureNote; - public FormattedString ColoredPassword => GeneratedValueFormatter.Format(Cipher.Login.Password); + public FormattedString ColoredPassword => Cipher?.Login != null ? GeneratedValueFormatter.Format(Cipher.Login.Password) : string.Empty; public FormattedString UpdatedText { get @@ -251,8 +251,8 @@ namespace Bit.App.Pages } public double TotpProgress => string.IsNullOrEmpty(TotpSec) ? 0 : double.Parse(TotpSec) * 100 / _totpInterval; public bool IsDeleted => Cipher.IsDeleted; - public bool CanEdit => !Cipher.IsDeleted; - public bool CanClone => Cipher.IsClonable; + public bool CanEdit => Cipher != null && !Cipher.IsDeleted; + public bool CanClone => Cipher != null && Cipher.IsClonable; public async Task LoadAsync(Action finishedLoadingAction = null) {