diff --git a/WooCommerce/Classes/ViewRelated/Dashboard/DashboardViewController.swift b/WooCommerce/Classes/ViewRelated/Dashboard/DashboardViewController.swift index db6e314d9ee..c7d7657da1d 100644 --- a/WooCommerce/Classes/ViewRelated/Dashboard/DashboardViewController.swift +++ b/WooCommerce/Classes/ViewRelated/Dashboard/DashboardViewController.swift @@ -543,6 +543,12 @@ private extension DashboardViewController { return } + // Resets the Auto Layout constraint that pins the previous content view to the bottom of the header view. + // Otherwise, if `contentTopToHeaderConstraint?.isActive = true` is called after the previous content view is removed + // in the next line `remove(previousDashboardUI)`, the app crashes because the content view is no longer in the + // view hierarchy. + contentTopToHeaderConstraint = nil + // Tears down the previous child view controller. if let previousDashboardUI = dashboardUI { remove(previousDashboardUI)