Fix potential NPE on Optional objects
This commit is contained in:
parent
2b58c0e5ab
commit
8140d90826
|
@ -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 New Issue