mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-22 17:35:54 +03:00
Fix potential NPE on Optional objects
This commit is contained in:
parent
2b58c0e5ab
commit
8140d90826
3 changed files with 3 additions and 2 deletions
1
changelog.d/4428.bugfix
Normal file
1
changelog.d/4428.bugfix
Normal file
|
@ -0,0 +1 @@
|
|||
Fix potential NullPointerException crashes in Room and User account data sources
|
|
@ -43,7 +43,7 @@ internal class RoomAccountDataDataSource @Inject constructor(@SessionDatabase pr
|
|||
|
||||
fun getLiveAccountDataEvent(roomId: String, type: String): LiveData<Optional<RoomAccountDataEvent>> {
|
||||
return Transformations.map(getLiveAccountDataEvents(roomId, setOf(type))) {
|
||||
it.firstOrNull()?.toOptional()
|
||||
it.firstOrNull().toOptional()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ internal class UserAccountDataDataSource @Inject constructor(@SessionDatabase pr
|
|||
|
||||
fun getLiveAccountDataEvent(type: String): LiveData<Optional<UserAccountDataEvent>> {
|
||||
return Transformations.map(getLiveAccountDataEvents(setOf(type))) {
|
||||
it.firstOrNull()?.toOptional()
|
||||
it.firstOrNull().toOptional()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue