Fix Client.getJoinedRoom crash when a room doesn't exist locally (#4656)
This commit is contained in:
parent
3235238999
commit
d97473f42b
1 changed files with 4 additions and 9 deletions
|
|
@ -267,17 +267,12 @@ class RustMatrixClient(
|
|||
}
|
||||
}
|
||||
|
||||
override suspend fun getRoom(roomId: RoomId): BaseRoom? {
|
||||
return roomFactory.getBaseRoom(roomId)
|
||||
override suspend fun getRoom(roomId: RoomId): BaseRoom? = withContext(sessionDispatcher) {
|
||||
roomFactory.getBaseRoom(roomId)
|
||||
}
|
||||
|
||||
override suspend fun getJoinedRoom(roomId: RoomId): JoinedRoom? {
|
||||
return try {
|
||||
(roomFactory.getJoinedRoomOrPreview(roomId) as GetRoomResult.Joined).joinedRoom
|
||||
} catch (e: ClassCastException) {
|
||||
Timber.e(e, "Room $roomId is not a joined room")
|
||||
null
|
||||
}
|
||||
override suspend fun getJoinedRoom(roomId: RoomId): JoinedRoom? = withContext(sessionDispatcher) {
|
||||
(roomFactory.getJoinedRoomOrPreview(roomId) as? GetRoomResult.Joined)?.joinedRoom
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue