From 403b859c3126d97ae489b33205cc5c59ee269eaf Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Sun, 28 Jun 2020 03:14:53 -0500 Subject: [PATCH] Verify that the section exists before accessing it so that we don't crash on the new SDK --- iOS/MasterTimeline/MasterTimelineViewController.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/iOS/MasterTimeline/MasterTimelineViewController.swift b/iOS/MasterTimeline/MasterTimelineViewController.swift index 4fa7410a0..efd541abe 100644 --- a/iOS/MasterTimeline/MasterTimelineViewController.swift +++ b/iOS/MasterTimeline/MasterTimelineViewController.swift @@ -611,7 +611,8 @@ private extension MasterTimelineViewController { } tableView.selectRow(at: nil, animated: false, scrollPosition: .top) - if resetScroll && dataSource.snapshot().itemIdentifiers(inSection: 0).count > 0 { + let dataSourceSnapshot = dataSource.snapshot() + if resetScroll && dataSourceSnapshot.indexOfSection(0) != nil && dataSourceSnapshot.itemIdentifiers(inSection: 0).count > 0 { tableView.scrollToRow(at: IndexPath(row: 0, section: 0), at: .top, animated: false) }