From: Shane Neuville Date: Mon, 1 Apr 2019 08:53:53 +0000 (-0600) Subject: Check if Element parent is null before getting the padding insets (#5757) X-Git-Tag: accepted/tizen/5.5/unified/20200421.150457~430^2~23 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5f9bf9d8c4263815c2d5346e71e9e42d735d766b;p=platform%2Fcore%2Fcsapi%2Fxsf.git Check if Element parent is null before getting the padding insets (#5757) * Check if Element parent is null before getting the padding insets * - move if up earlier --- diff --git a/Xamarin.Forms.Platform.iOS/Renderers/PageRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/PageRenderer.cs index a4c9e12..2295f19 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/PageRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/PageRenderer.cs @@ -242,7 +242,8 @@ namespace Xamarin.Forms.Platform.iOS void UpdateUseSafeArea() { - if (!Forms.IsiOS11OrNewer) return; + if (!Forms.IsiOS11OrNewer) + return; if (!UsingSafeArea) { @@ -258,7 +259,14 @@ namespace Xamarin.Forms.Platform.iOS void UpdateShellInsetPadding() { - var setInsets = Shell.GetSetPaddingInsets(Element) || Shell.GetSetPaddingInsets(Element?.Parent); + if (Element == null) + return; + + var setInsets = Shell.GetSetPaddingInsets(Element); + + if (!setInsets && Element.Parent != null) + setInsets = Shell.GetSetPaddingInsets(Element.Parent); + if (setInsets) { nfloat topPadding = 0;