Skip to content

Commit fa3796d

Browse files
committed
Fix crash when the session is deleted on another client.
1 parent 1802a2b commit fa3796d

File tree

1 file changed

+5
-1
lines changed
  • features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl

1 file changed

+5
-1
lines changed

features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListPresenter.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import io.element.android.features.roomlist.impl.search.RoomListSearchEvents
3939
import io.element.android.features.roomlist.impl.search.RoomListSearchState
4040
import io.element.android.libraries.architecture.AsyncData
4141
import io.element.android.libraries.architecture.Presenter
42+
import io.element.android.libraries.core.bool.orFalse
4243
import io.element.android.libraries.designsystem.utils.snackbar.SnackbarDispatcher
4344
import io.element.android.libraries.designsystem.utils.snackbar.collectSnackbarMessageAsState
4445
import io.element.android.libraries.featureflag.api.FeatureFlagService
@@ -218,7 +219,10 @@ class RoomListPresenter @Inject constructor(
218219
}
219220
}
220221
val needsSlidingSyncMigration by produceState(false) {
221-
value = client.isNativeSlidingSyncSupported() && !client.isUsingNativeSlidingSync()
222+
value = runCatching {
223+
// Note: this can fail when the session is destroyed from another client.
224+
client.isNativeSlidingSyncSupported() && !client.isUsingNativeSlidingSync()
225+
}.getOrNull().orFalse()
222226
}
223227
return when {
224228
showEmpty -> RoomListContentState.Empty

0 commit comments

Comments
 (0)