Skip to content

Commit 8dd0cee

Browse files
dseverns-livefrontSaintPatrck
authored andcommitted
PM-14433 update flow type to nullable so we can handle gracefully and avoid crash. (#4231)
1 parent b76f720 commit 8dd0cee

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

app/src/main/java/com/x8bit/bitwarden/data/vault/datasource/disk/VaultDiskSourceImpl.kt

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import kotlinx.coroutines.async
1717
import kotlinx.coroutines.awaitAll
1818
import kotlinx.coroutines.coroutineScope
1919
import kotlinx.coroutines.flow.Flow
20+
import kotlinx.coroutines.flow.filterNotNull
2021
import kotlinx.coroutines.flow.first
2122
import kotlinx.coroutines.flow.map
2223
import kotlinx.coroutines.flow.merge
@@ -124,6 +125,7 @@ class VaultDiskSourceImpl(
124125
override fun getDomains(userId: String): Flow<SyncResponseJson.Domains> =
125126
domainsDao
126127
.getDomains(userId)
128+
.filterNotNull()
127129
.map { entity ->
128130
withContext(dispatcherManager.default) {
129131
json.decodeFromString<SyncResponseJson.Domains>(entity.domainsJson)

app/src/main/java/com/x8bit/bitwarden/data/vault/datasource/disk/dao/DomainsDao.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ interface DomainsDao {
2525
@Query("SELECT * FROM domains WHERE user_id = :userId")
2626
fun getDomains(
2727
userId: String,
28-
): Flow<DomainsEntity>
28+
): Flow<DomainsEntity?>
2929

3030
/**
3131
* Inserts domains into the database.

0 commit comments

Comments
 (0)