Skip to content

Commit

Permalink
PM-14433 update flow type to nullable so we can handle gracefully and…
Browse files Browse the repository at this point in the history
… avoid crash. (#4231)
  • Loading branch information
dseverns-livefront authored Nov 5, 2024
1 parent 5523d99 commit 5a4b8d6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -122,6 +123,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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 5a4b8d6

Please sign in to comment.