1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 16:23:44 +00:00

Defend map Calls

This commit is contained in:
Justin Baur
2024-05-23 12:28:44 -04:00
parent 0e60a3a92a
commit 0c0fe31d40
2 changed files with 2 additions and 2 deletions

View File

@@ -33,7 +33,7 @@ const DECRYPTED_COLLECTION_DATA_KEY = DeriveDefinition.from<
CollectionView[], CollectionView[],
{ collectionService: CollectionService } { collectionService: CollectionService }
>(ENCRYPTED_COLLECTION_DATA_KEY, { >(ENCRYPTED_COLLECTION_DATA_KEY, {
deserializer: (obj) => obj.map((collection) => CollectionView.fromJSON(collection)), deserializer: (obj) => obj?.map((collection) => CollectionView.fromJSON(collection)),
derive: async (collections: Record<CollectionId, CollectionData>, { collectionService }) => { derive: async (collections: Record<CollectionId, CollectionData>, { collectionService }) => {
const data: Collection[] = []; const data: Collection[] = [];
for (const id in collections ?? {}) { for (const id in collections ?? {}) {

View File

@@ -16,7 +16,7 @@ export const FOLDER_DECRYPTED_FOLDERS = DeriveDefinition.from<
FolderView[], FolderView[],
{ folderService: FolderService; cryptoService: CryptoService } { folderService: FolderService; cryptoService: CryptoService }
>(FOLDER_ENCRYPTED_FOLDERS, { >(FOLDER_ENCRYPTED_FOLDERS, {
deserializer: (obj) => obj.map((f) => FolderView.fromJSON(f)), deserializer: (obj) => obj?.map((f) => FolderView.fromJSON(f)),
derive: async (from, { folderService, cryptoService }) => { derive: async (from, { folderService, cryptoService }) => {
const folders = Object.values(from || {}).map((f) => new Folder(f)); const folders = Object.values(from || {}).map((f) => new Folder(f));