mirror of
https://github.com/bitwarden/android.git
synced 2024-11-21 17:05:44 +03:00
PM-10917: Fix crash caused when adding an item from a collection (#3809)
This commit is contained in:
parent
eb2ba8e598
commit
b56a21b6e5
2 changed files with 3 additions and 4 deletions
|
@ -37,8 +37,8 @@ fun VaultItemListingState.ItemListingType.Vault.toVaultItemCipherType(): VaultIt
|
|||
is VaultItemListingState.ItemListingType.Vault.Identity -> VaultItemCipherType.IDENTITY
|
||||
is VaultItemListingState.ItemListingType.Vault.SecureNote -> VaultItemCipherType.SECURE_NOTE
|
||||
is VaultItemListingState.ItemListingType.Vault.Login -> VaultItemCipherType.LOGIN
|
||||
is VaultItemListingState.ItemListingType.Vault.Collection -> VaultItemCipherType.LOGIN
|
||||
is VaultItemListingState.ItemListingType.Vault.Trash,
|
||||
is VaultItemListingState.ItemListingType.Vault.Collection,
|
||||
is VaultItemListingState.ItemListingType.Vault.Folder,
|
||||
-> throw IllegalStateException("Cannot create vault item from this VaultItemListingState!")
|
||||
}
|
||||
|
|
|
@ -118,6 +118,7 @@ class VaultItemListingStateExtensionsTest {
|
|||
VaultItemListingState.ItemListingType.Vault.Identity,
|
||||
VaultItemListingState.ItemListingType.Vault.SecureNote,
|
||||
VaultItemListingState.ItemListingType.Vault.Login,
|
||||
VaultItemListingState.ItemListingType.Vault.Collection(collectionId = "mockId"),
|
||||
)
|
||||
|
||||
val result = itemListingTypes.map { it.toVaultItemCipherType() }
|
||||
|
@ -128,6 +129,7 @@ class VaultItemListingStateExtensionsTest {
|
|||
VaultItemCipherType.IDENTITY,
|
||||
VaultItemCipherType.SECURE_NOTE,
|
||||
VaultItemCipherType.LOGIN,
|
||||
VaultItemCipherType.LOGIN,
|
||||
),
|
||||
result,
|
||||
)
|
||||
|
@ -137,9 +139,6 @@ class VaultItemListingStateExtensionsTest {
|
|||
fun `toVaultItemCipherType should throw an exception for unsupported ItemListingTypes`() {
|
||||
val itemListingTypes = listOf(
|
||||
VaultItemListingState.ItemListingType.Vault.Trash,
|
||||
VaultItemListingState.ItemListingType.Vault.Collection(
|
||||
collectionId = "mockId",
|
||||
),
|
||||
VaultItemListingState.ItemListingType.Vault.Folder(
|
||||
folderId = "mockId",
|
||||
),
|
||||
|
|
Loading…
Reference in a new issue