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