From 0756a2d3e44a0b288cbc8f3ec7dc6db235da987c Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Mon, 8 Jan 2024 11:41:29 +0100 Subject: [PATCH] exclude `items.count()`, which is not a valid index for the list. --- .../features/messages/impl/timeline/TimelinePresenter.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/TimelinePresenter.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/TimelinePresenter.kt index aff187d233..31e36e86f9 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/TimelinePresenter.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/TimelinePresenter.kt @@ -247,7 +247,7 @@ class TimelinePresenter @AssistedInject constructor( } private fun getLastEventIdBeforeOrAt(index: Int, items: ImmutableList): EventId? { - for (i in index..items.count()) { + for (i in index until items.count()) { val item = items[i] if (item is TimelineItem.Event) { return item.eventId