Fix crash upon split view expansion before sidebar VC is loaded

This commit is contained in:
Shadowfacts 2021-01-12 22:16:20 -05:00
parent 0bdcda1b23
commit 678ed4959b
1 changed files with 2 additions and 0 deletions

View File

@ -95,6 +95,8 @@ class MainSidebarViewController: UIViewController {
}
func select(item: Item, animated: Bool) {
// ensure view is loaded, since dataSource is created in viewDidLoad
loadViewIfNeeded()
guard let indexPath = dataSource.indexPath(for: item) else { return }
collectionView.selectItem(at: indexPath, animated: animated, scrollPosition: .top)
itemLastSelectedTimestamps[item] = Date()