diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/adapters/EventListAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/adapters/EventListAdapter.kt index 04c5a94ab..d6d694cc2 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/adapters/EventListAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/adapters/EventListAdapter.kt @@ -39,17 +39,19 @@ class EventListAdapter(activity: SimpleActivity, val listItems: ArrayList - if (firstNonPastSectionIndex == 0 && listItem is ListSection) { + if (firstNonPastSectionIndex == -1 && listItem is ListSection) { if (!listItem.isPastSection) { firstNonPastSectionIndex = index } } } - activity.runOnUiThread { - recyclerView.scrollToPosition(firstNonPastSectionIndex) + if (firstNonPastSectionIndex != -1) { + activity.runOnUiThread { + recyclerView.scrollToPosition(firstNonPastSectionIndex) + } } }