diff --git a/Xamarin.Forms.Platform.iOS/Renderers/ShellSectionRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/ShellSectionRenderer.cs index 6c99404782c..db025b09692 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/ShellSectionRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/ShellSectionRenderer.cs @@ -703,11 +703,15 @@ public override void WillShowViewController(UINavigationController navigationCon System.Diagnostics.Debug.Write($"WillShowViewController {viewController.GetHashCode()}"); var element = _self.ElementForViewController(viewController); - bool navBarVisible; - if (element is ShellSection) - navBarVisible = _self._renderer.ShowNavBar; - else - navBarVisible = Shell.GetNavBarIsVisible(element); + bool navBarVisible = false; + + if (element != null) + { + if (element is ShellSection) + navBarVisible = _self._renderer.ShowNavBar; + else + navBarVisible = Shell.GetNavBarIsVisible(element); + } navigationController.SetNavigationBarHidden(!navBarVisible, true);