Skip to content

Commit 15160a8

Browse files
Move navigationController check out of the closure to avoid showing account creation flow when we can't proceed after that.
1 parent e0ac812 commit 15160a8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

WooCommerce/Classes/Authentication/Navigation Exceptions/NotWPAccountViewModel.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,14 @@ private extension NotWPAccountViewModel {
114114

115115
func createAnAccountButtonTapped(in viewController: UIViewController?) {
116116
analytics.track(.createAccountOnInvalidEmailScreenTapped)
117-
guard let viewController else {
117+
guard let viewController,
118+
let navigationController = viewController.navigationController else {
119+
DDLogWarn("⚠️ Unable to proceed with account creation as view controller/navigation controller is nil.")
118120
return
119121
}
120122

121123
let accountCreationController = AccountCreationFormHostingController(viewModel: .init()) { [weak self] in
122-
guard let self, let navigationController = viewController.navigationController else { return }
124+
guard let self else { return }
123125
self.launchStorePicker(from: navigationController)
124126
}
125127
viewController.show(accountCreationController, sender: self)

0 commit comments

Comments
 (0)