Skip to content

Commit 929c7fb

Browse files
authored
Merge pull request #5549 from woocommerce/issue/5543-save-shipping-label-crash
Shipping Labels: Fix crash when saving label after opening order from push notification
2 parents adf1be9 + 1f72b51 commit 929c7fb

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

RELEASE-NOTES.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
*** PLEASE FOLLOW THIS FORMAT: [<priority indicator, more stars = higher priority>] <description> [<PR URL>]
22

3+
8.2
4+
-----
5+
- [*] Shipping Labels: Fixes a crash when saving a new shipping label after opening the order from a push notification. [https://github.com/woocommerce/woocommerce-ios/pull/5549]
6+
37
8.1
48
-----
59
- [***] Now it's possible to filter Order List by multiple statuses and date ranges. Plus, we removed the top tab bar on Orders Tab. [https://github.com/woocommerce/woocommerce-ios/pull/5491]

WooCommerce/Classes/ViewRelated/Orders/Order Details/OrderDetailsViewController.swift

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -547,8 +547,15 @@ private extension OrderDetailsViewController {
547547
}
548548
}
549549
shippingLabelFormVC.onLabelSave = { [weak self] in
550-
guard let self = self else { return }
551-
self.navigationController?.popToViewController(self, animated: true)
550+
guard let self = self, let navigationController = self.navigationController, navigationController.viewControllers.contains(self) else {
551+
// Navigate back to order details when presented from push notification
552+
if let orderLoaderVC = self?.parent as? OrderLoaderViewController {
553+
self?.navigationController?.popToViewController(orderLoaderVC, animated: true)
554+
}
555+
return
556+
}
557+
558+
navigationController.popToViewController(self, animated: true)
552559
}
553560
shippingLabelFormVC.hidesBottomBarWhenPushed = true
554561
navigationController?.show(shippingLabelFormVC, sender: self)

0 commit comments

Comments
 (0)