mirror of
https://github.com/bitwarden/android.git
synced 2024-12-18 07:11:51 +03:00
PM-14433 update flow type to nullable so we can handle gracefully and avoid crash (#4263)
Co-authored-by: Dave Severns <149429124+dseverns-livefront@users.noreply.github.com>
This commit is contained in:
parent
96c6b9c214
commit
b6dfc3d17b
2 changed files with 3 additions and 1 deletions
|
@ -17,6 +17,7 @@ import kotlinx.coroutines.async
|
|||
import kotlinx.coroutines.awaitAll
|
||||
import kotlinx.coroutines.coroutineScope
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.filterNotNull
|
||||
import kotlinx.coroutines.flow.first
|
||||
import kotlinx.coroutines.flow.map
|
||||
import kotlinx.coroutines.flow.merge
|
||||
|
@ -124,6 +125,7 @@ class VaultDiskSourceImpl(
|
|||
override fun getDomains(userId: String): Flow<SyncResponseJson.Domains> =
|
||||
domainsDao
|
||||
.getDomains(userId)
|
||||
.filterNotNull()
|
||||
.map { entity ->
|
||||
withContext(dispatcherManager.default) {
|
||||
json.decodeFromString<SyncResponseJson.Domains>(entity.domainsJson)
|
||||
|
|
|
@ -25,7 +25,7 @@ interface DomainsDao {
|
|||
@Query("SELECT * FROM domains WHERE user_id = :userId")
|
||||
fun getDomains(
|
||||
userId: String,
|
||||
): Flow<DomainsEntity>
|
||||
): Flow<DomainsEntity?>
|
||||
|
||||
/**
|
||||
* Inserts domains into the database.
|
||||
|
|
Loading…
Reference in a new issue