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

Commit

Permalink
Fix #8517: Fix crash on launch due to active window changes (#8534)
Browse files Browse the repository at this point in the history
- Fix crash on active window during fresh install.
  • Loading branch information
Brandon-T authored and iccub committed Dec 7, 2023
1 parent c76fa33 commit f766540
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions App/iOS/Delegates/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -533,12 +533,15 @@ extension SceneDelegate {
let activeWindow = SessionWindow.getActiveWindow(context: DataController.swiftUIContext)
let activeSession = UIApplication.shared.openSessions
.compactMap({ BrowserState.getWindowInfo(from: $0) })
.first(where: { $0.windowId == activeWindow?.windowId.uuidString })
.first(where: { $0.windowId != nil && $0.windowId == activeWindow?.windowId.uuidString })

if activeSession != nil {
if !UIApplication.shared.supportsMultipleScenes {
// iPhones should not create new windows
return (activeWindow!.windowId, false, nil)
if let activeWindow = activeWindow {
// If there's no active window, fall through and create one
return (activeWindow.windowId, false, nil)
}
}

// An existing window is already active on screen
Expand Down

0 comments on commit f766540

Please sign in to comment.