PM-3349 PM-3350 Add null checks on CipherDetailsPageVM to avoid crash opening Secure Notes.

This commit is contained in:
Dinis Vieira 2023-10-01 23:15:55 +01:00
parent 9f6c8601d3
commit 0dbc23f734
No known key found for this signature in database
GPG key ID: 9389160FF6C295F3

View file

@ -149,7 +149,7 @@ namespace Bit.App.Pages
public bool IsIdentity => Cipher?.Type == Core.Enums.CipherType.Identity; public bool IsIdentity => Cipher?.Type == Core.Enums.CipherType.Identity;
public bool IsCard => Cipher?.Type == Core.Enums.CipherType.Card; public bool IsCard => Cipher?.Type == Core.Enums.CipherType.Card;
public bool IsSecureNote => Cipher?.Type == Core.Enums.CipherType.SecureNote; 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 public FormattedString UpdatedText
{ {
get get
@ -251,8 +251,8 @@ namespace Bit.App.Pages
} }
public double TotpProgress => string.IsNullOrEmpty(TotpSec) ? 0 : double.Parse(TotpSec) * 100 / _totpInterval; public double TotpProgress => string.IsNullOrEmpty(TotpSec) ? 0 : double.Parse(TotpSec) * 100 / _totpInterval;
public bool IsDeleted => Cipher.IsDeleted; public bool IsDeleted => Cipher.IsDeleted;
public bool CanEdit => !Cipher.IsDeleted; public bool CanEdit => Cipher != null && !Cipher.IsDeleted;
public bool CanClone => Cipher.IsClonable; public bool CanClone => Cipher != null && Cipher.IsClonable;
public async Task<bool> LoadAsync(Action finishedLoadingAction = null) public async Task<bool> LoadAsync(Action finishedLoadingAction = null)
{ {