Add some missing runCatching to protect innerRoom access.
May fix https://sentry.tools.element.io/organizations/element/issues/533226/events/e22d3a80ab204ce392e65c989c2753ac/
This commit is contained in:
parent
72ca2f9eb0
commit
8b161bf72c
1 changed files with 13 additions and 5 deletions
|
|
@ -105,8 +105,12 @@ class RustMatrixRoom(
|
||||||
|
|
||||||
override val roomInfoFlow: Flow<MatrixRoomInfo> = mxCallbackFlow {
|
override val roomInfoFlow: Flow<MatrixRoomInfo> = mxCallbackFlow {
|
||||||
launch {
|
launch {
|
||||||
val initial = innerRoom.roomInfo().let(matrixRoomInfoMapper::map)
|
runCatching { innerRoom.roomInfo() }
|
||||||
channel.trySend(initial)
|
.getOrNull()
|
||||||
|
?.let(matrixRoomInfoMapper::map)
|
||||||
|
?.let { initial ->
|
||||||
|
channel.trySend(initial)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
innerRoom.subscribeToRoomInfoUpdates(object : RoomInfoListener {
|
innerRoom.subscribeToRoomInfoUpdates(object : RoomInfoListener {
|
||||||
override fun call(roomInfo: RoomInfo) {
|
override fun call(roomInfo: RoomInfo) {
|
||||||
|
|
@ -623,9 +627,13 @@ class RustMatrixRoom(
|
||||||
innerRoom.sendCallNotificationIfNeeded()
|
innerRoom.sendCallNotificationIfNeeded()
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun setSendQueueEnabled(enabled: Boolean) = withContext(roomDispatcher) {
|
override suspend fun setSendQueueEnabled(enabled: Boolean) {
|
||||||
Timber.d("setSendQueuesEnabled: $enabled")
|
withContext(roomDispatcher) {
|
||||||
innerRoom.enableSendQueue(enabled)
|
Timber.d("setSendQueuesEnabled: $enabled")
|
||||||
|
runCatching {
|
||||||
|
innerRoom.enableSendQueue(enabled)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun saveComposerDraft(composerDraft: ComposerDraft): Result<Unit> = runCatching {
|
override suspend fun saveComposerDraft(composerDraft: ComposerDraft): Result<Unit> = runCatching {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue