Skip to content

Commit 3cb72ca

Browse files
committed
Fix crash when calling Client.predecessorRoom when the room is destroyed
1 parent 881877b commit 3cb72ca

File tree

1 file changed

+3
-1
lines changed
  • libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/room

1 file changed

+3
-1
lines changed

libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/room/RustBaseRoom.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ class RustBaseRoom(
8585
}.stateIn(roomCoroutineScope, started = SharingStarted.Lazily, initialValue = initialRoomInfo)
8686

8787
override fun predecessorRoom(): PredecessorRoom? {
88-
return innerRoom.predecessorRoom()?.map()
88+
return runCatchingExceptions { innerRoom.predecessorRoom()?.map() }
89+
.onFailure { Timber.e(it, "Could not get predecessor room") }
90+
.getOrNull()
8991
}
9092

9193
override suspend fun subscribeToSync() = roomSyncSubscriber.subscribe(roomId)

0 commit comments

Comments
 (0)