Fix crash when accessing SegmentedPageViewController before it's loaded
This commit is contained in:
parent
79b9108a8f
commit
358d81b5cf
|
@ -85,7 +85,7 @@ class TimelinesPageViewController: SegmentedPageViewController<TimelinesPageView
|
|||
}
|
||||
|
||||
func stateRestorationActivity() -> NSUserActivity? {
|
||||
return (currentViewController as! TimelineViewController).stateRestorationActivity()
|
||||
return (currentViewController as? TimelineViewController)?.stateRestorationActivity()
|
||||
}
|
||||
|
||||
func restoreActivity(_ activity: NSUserActivity) {
|
||||
|
|
|
@ -23,8 +23,8 @@ class SegmentedPageViewController<Page: SegmentedPageViewControllerPage>: UIPage
|
|||
var currentIndex: Int! {
|
||||
pages.firstIndex(of: currentPage)
|
||||
}
|
||||
var currentViewController: UIViewController {
|
||||
viewControllers!.first!
|
||||
var currentViewController: UIViewController! {
|
||||
viewControllers?.first
|
||||
}
|
||||
|
||||
let segmentedControl = ScrollingSegmentedControl<Page>()
|
||||
|
|
Loading…
Reference in New Issue