mirror of
https://github.com/bitwarden/mobile
synced 2025-12-15 07:43:37 +00:00
more null checking on save
This commit is contained in:
@@ -401,12 +401,13 @@ namespace Bit.App.Pages
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Cipher.Fields = Fields != null && Fields.Any() ? Fields.Select(f => f.Field).ToList() : null;
|
Cipher.Fields = Fields != null && Fields.Any() ?
|
||||||
|
Fields.Where(f => f != null).Select(f => f.Field).ToList() : null;
|
||||||
if(Cipher.Login != null)
|
if(Cipher.Login != null)
|
||||||
{
|
{
|
||||||
Cipher.Login.Uris = Uris?.ToList();
|
Cipher.Login.Uris = Uris?.ToList();
|
||||||
if(!EditMode && Cipher.Type == CipherType.Login && (Cipher.Login.Uris?.Count ?? 0) == 1 &&
|
if(!EditMode && Cipher.Type == CipherType.Login && (Cipher.Login.Uris?.Count ?? 0) == 1 &&
|
||||||
string.IsNullOrWhiteSpace(Cipher.Login.Uris.First().Uri))
|
string.IsNullOrWhiteSpace(Cipher.Login.Uris.First()?.Uri))
|
||||||
{
|
{
|
||||||
Cipher.Login.Uris = null;
|
Cipher.Login.Uris = null;
|
||||||
}
|
}
|
||||||
@@ -414,7 +415,7 @@ namespace Bit.App.Pages
|
|||||||
|
|
||||||
if(!EditMode && Cipher.OrganizationId != null)
|
if(!EditMode && Cipher.OrganizationId != null)
|
||||||
{
|
{
|
||||||
if(!Collections?.Any(c => c.Checked) ?? true)
|
if(!Collections?.Any(c => c?.Checked ?? false) ?? true)
|
||||||
{
|
{
|
||||||
await Page.DisplayAlert(AppResources.AnErrorHasOccurred, AppResources.SelectOneCollection,
|
await Page.DisplayAlert(AppResources.AnErrorHasOccurred, AppResources.SelectOneCollection,
|
||||||
AppResources.Ok);
|
AppResources.Ok);
|
||||||
@@ -422,7 +423,8 @@ namespace Bit.App.Pages
|
|||||||
}
|
}
|
||||||
|
|
||||||
Cipher.CollectionIds = Collections.Any() ?
|
Cipher.CollectionIds = Collections.Any() ?
|
||||||
new HashSet<string>(Collections.Where(c => c.Checked).Select(c => c.Collection.Id)) : null;
|
new HashSet<string>(Collections.Where(c => c?.Checked ?? false &&
|
||||||
|
c.Collection != null).Select(c => c.Collection.Id)) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var cipher = await _cipherService.EncryptAsync(Cipher);
|
var cipher = await _cipherService.EncryptAsync(Cipher);
|
||||||
|
|||||||
Reference in New Issue
Block a user