Skip to content
Snippets Groups Projects
Commit 697d87f0 authored by Taras's avatar Taras
Browse files

Catch error on trying to restart the timeline

parent bf93d57c
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,7 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import org.futo.circles.core.feature.timeline.builder.MultiTimelineBuilder
import org.matrix.android.sdk.api.extensions.tryOrNull
import org.matrix.android.sdk.api.session.getRoom
import org.matrix.android.sdk.api.session.room.Room
import org.matrix.android.sdk.api.session.room.timeline.Timeline
......@@ -31,7 +32,7 @@ class MultiTimelinesDataSource @Inject constructor(
}
override fun onRestartTimeline(timelineId: String, throwable: Throwable) {
timelines.firstOrNull { it.timelineID == timelineId }?.restartWithEventId(null)
tryOrNull { timelines.firstOrNull { it.timelineID == timelineId }?.restartWithEventId(null) }
}
override fun clearTimeline() {
......
......@@ -6,6 +6,7 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import org.futo.circles.core.feature.timeline.builder.SingleTimelineBuilder
import org.matrix.android.sdk.api.extensions.tryOrNull
import org.matrix.android.sdk.api.session.room.timeline.Timeline
import javax.inject.Inject
......@@ -23,7 +24,7 @@ class SingleTimelineDataSource @Inject constructor(
}
override fun onRestartTimeline(timelineId: String, throwable: Throwable) {
timeline?.restartWithEventId(null)
tryOrNull { timeline?.restartWithEventId(null) }
}
override fun clearTimeline() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment