From 83ed717dcd6470e2a18b176d0c14d3490753f463 Mon Sep 17 00:00:00 2001 From: Mauro Romito Date: Fri, 21 Jul 2023 12:04:23 +0200 Subject: [PATCH] better code --- .../Screens/RoomScreen/View/TimelineTableViewController.swift | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ElementX/Sources/Screens/RoomScreen/View/TimelineTableViewController.swift b/ElementX/Sources/Screens/RoomScreen/View/TimelineTableViewController.swift index f355b8cd9..240e0e866 100644 --- a/ElementX/Sources/Screens/RoomScreen/View/TimelineTableViewController.swift +++ b/ElementX/Sources/Screens/RoomScreen/View/TimelineTableViewController.swift @@ -224,8 +224,7 @@ class TimelineTableViewController: UIViewController { /// Scrolls to the top of the timeline. private func scrollToTop(animated: Bool) { - let index = timelineItemsIDs.count - 1 - guard index >= 0 else { + guard !timelineItemsIDs.isEmpty else { return } tableView.scrollToRow(at: IndexPath(item: timelineItemsIDs.count - 1, section: 0), at: .bottom, animated: animated)