diff --git a/src/App/Pages/Vault/CollectionsPageViewModel.cs b/src/App/Pages/Vault/CollectionsPageViewModel.cs index a57a0be24..1fef161e7 100644 --- a/src/App/Pages/Vault/CollectionsPageViewModel.cs +++ b/src/App/Pages/Vault/CollectionsPageViewModel.cs @@ -58,7 +58,8 @@ namespace Bit.App.Pages public async Task SubmitAsync() { - if(!Collections.Any(c => c.Checked)) + var selectedCollectionIds = Collections?.Where(c => c.Checked).Select(c => c.Collection.Id); + if(!selectedCollectionIds?.Any() ?? true) { await Page.DisplayAlert(AppResources.AnErrorHasOccurred, AppResources.SelectOneCollection, AppResources.Ok); @@ -71,8 +72,7 @@ namespace Bit.App.Pages return false; } - _cipherDomain.CollectionIds = new HashSet( - Collections.Where(c => c.Checked).Select(c => c.Collection.Id)); + _cipherDomain.CollectionIds = new HashSet(selectedCollectionIds); try { await _deviceActionService.ShowLoadingAsync(AppResources.Saving); diff --git a/src/App/Pages/Vault/SharePageViewModel.cs b/src/App/Pages/Vault/SharePageViewModel.cs index f57f9eec3..013f2d5eb 100644 --- a/src/App/Pages/Vault/SharePageViewModel.cs +++ b/src/App/Pages/Vault/SharePageViewModel.cs @@ -86,7 +86,8 @@ namespace Bit.App.Pages public async Task SubmitAsync() { - if(!Collections?.Any(c => c.Checked) ?? true) + var selectedCollectionIds = Collections?.Where(c => c.Checked).Select(c => c.Collection.Id); + if(!selectedCollectionIds?.Any() ?? true) { await Page.DisplayAlert(AppResources.AnErrorHasOccurred, AppResources.SelectOneCollection, AppResources.Ok); @@ -102,8 +103,7 @@ namespace Bit.App.Pages var cipherDomain = await _cipherService.GetAsync(CipherId); var cipherView = await cipherDomain.DecryptAsync(); - var checkedCollectionIds = new HashSet( - Collections.Where(c => c.Checked).Select(c => c.Collection.Id)); + var checkedCollectionIds = new HashSet(selectedCollectionIds); try { await _deviceActionService.ShowLoadingAsync(AppResources.Saving);