1
0
mirror of https://github.com/bitwarden/jslib synced 2025-12-31 23:53:15 +00:00

[bug] Null check lists when changing the vault filter

Sometimes when changing an organization fault filter the system can end up in a postion where the filter modifier selected isn't valid for the newly selected organization.
The clearest example of this are collections, since changing any org filter with a collection already selected will make that collection selection invalid.

Because of this, when an organization filter is selected we check to make sure modifiers are still valid. If they aren't we clear them.
This isn't working if a list is checked and this list is null. An error throws and the filter doesn't change. This commit adds a null check to keep things moving.
This commit is contained in:
addison
2022-04-14 12:41:43 -04:00
parent e021b2817f
commit ffdd9507ff

View File

@@ -89,7 +89,10 @@ export class VaultFilterComponent implements OnInit {
}
protected pruneInvalidFolderSelection(filter: VaultFilter): VaultFilter {
if (filter.selectedFolder && !this.folders.hasId(filter.selectedFolderId)) {
if (
filter.selectedFolder &&
(this.folders == null || !this.folders.hasId(filter.selectedFolderId))
) {
filter.selectedFolder = false;
filter.selectedFolderId = null;
}
@@ -99,7 +102,7 @@ export class VaultFilterComponent implements OnInit {
protected pruneInvalidCollectionSelection(filter: VaultFilter): VaultFilter {
if (
filter.selectedCollectionId != null &&
!this.collections.hasId(filter.selectedCollectionId)
(this.collections == null || !this.collections.hasId(filter.selectedCollectionId))
) {
filter.selectedCollectionId = null;
}