Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Ref #636: Don't crash the app when no tab found for tab tray transition.
Browse files Browse the repository at this point in the history
  • Loading branch information
iccub committed Jan 22, 2020
1 parent 24c14e7 commit 1adb3cb
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Client/Frontend/Browser/BrowserTrayAnimators.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import UIKit
import Shared

private let log = Logger.browserLogger

class TrayToBrowserAnimator: NSObject, UIViewControllerAnimatedTransitioning {
func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
if let bvc = transitionContext.viewController(forKey: .to) as? BrowserViewController,
Expand All @@ -26,7 +28,9 @@ private extension TrayToBrowserAnimator {
let displayedTabs = tabManager.tabsForCurrentMode

guard let selectedTab = bvc.tabManager.selectedTab, let expandFromIndex = displayedTabs.firstIndex(of: selectedTab) else {
fatalError("No tab selected for transition.")
log.error("No tab selected for transition.")
transitionContext.completeTransition(true)
return
}
bvc.view.frame = transitionContext.finalFrame(for: bvc)

Expand Down Expand Up @@ -149,7 +153,9 @@ private extension BrowserToTrayAnimator {
let tabManager = bvc.tabManager
let displayedTabs = tabManager.tabsForCurrentMode
guard let selectedTab = bvc.tabManager.selectedTab, let scrollToIndex = displayedTabs.firstIndex(of: selectedTab) else {
fatalError("No tab selected for transition.")
log.error("No tab selected for transition.")
transitionContext.completeTransition(true)
return
}

tabTray.view.frame = transitionContext.finalFrame(for: tabTray)
Expand Down

0 comments on commit 1adb3cb

Please sign in to comment.