forked from shadowfacts/Tusker
Fix crash upon split view expansion before sidebar VC is loaded
This commit is contained in:
parent
0bdcda1b23
commit
678ed4959b
|
@ -95,6 +95,8 @@ class MainSidebarViewController: UIViewController {
|
||||||
}
|
}
|
||||||
|
|
||||||
func select(item: Item, animated: Bool) {
|
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 }
|
guard let indexPath = dataSource.indexPath(for: item) else { return }
|
||||||
collectionView.selectItem(at: indexPath, animated: animated, scrollPosition: .top)
|
collectionView.selectItem(at: indexPath, animated: animated, scrollPosition: .top)
|
||||||
itemLastSelectedTimestamps[item] = Date()
|
itemLastSelectedTimestamps[item] = Date()
|
||||||
|
|
Loading…
Reference in New Issue