From 706d09dc7fc62b78fb61d40b1f226cece972b60d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=C2=A0Buczek?= Date: Wed, 8 Jan 2020 15:23:26 +0100 Subject: [PATCH] Ref #636: Don't crash the app when no tab found for tab tray transition. --- Client/Frontend/Browser/BrowserTrayAnimators.swift | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Client/Frontend/Browser/BrowserTrayAnimators.swift b/Client/Frontend/Browser/BrowserTrayAnimators.swift index dc5359494cb..dcd16dbaf55 100644 --- a/Client/Frontend/Browser/BrowserTrayAnimators.swift +++ b/Client/Frontend/Browser/BrowserTrayAnimators.swift @@ -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, @@ -26,7 +28,8 @@ 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.") + return } bvc.view.frame = transitionContext.finalFrame(for: bvc) @@ -149,7 +152,8 @@ 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.") + return } tabTray.view.frame = transitionContext.finalFrame(for: tabTray)