Skip to content

Commit 530b42e

Browse files
committed
Fix crash on SplitViewController Xcode 16.3
1 parent b8fb185 commit 530b42e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Flat/Modules/Base/MainSplitViewController.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,13 @@ class MainSplitViewController: UISplitViewController, UISplitViewControllerDeleg
137137
if let _ = vc as? UINavigationController {
138138
setViewController(vc, for: .secondary)
139139
} else {
140-
let targetVC = BaseNavigationViewController(rootViewController: vc)
141-
setViewController(targetVC, for: .secondary)
140+
if let parent = vc.parent, parent is BaseNavigationViewController {
141+
// If the vc is already in a navigation controller, just set it as secondary
142+
setViewController(parent, for: .secondary)
143+
} else {
144+
let targetVC = BaseNavigationViewController(rootViewController: vc)
145+
setViewController(targetVC, for: .secondary)
146+
}
142147
}
143148
if hidePrimary {
144149
hide(.primary)

0 commit comments

Comments
 (0)