[GTK] Fix NullReferenceException in NavigationPageRenderer (#6462)
authormfkl <martin@videolabs.io>
Tue, 18 Jun 2019 03:05:08 +0000 (05:05 +0200)
committerSamantha Houts <samhouts@users.noreply.github.com>
Tue, 18 Jun 2019 03:05:08 +0000 (20:05 -0700)
BackgroundImageSource is null by default

Xamarin.Forms.Platform.GTK/Renderers/NavigationPageRenderer.cs

index c30d8ea..29d9be9 100644 (file)
@@ -158,9 +158,14 @@ namespace Xamarin.Forms.Platform.GTK.Renderers
 
                        if (Widget?.Parent is EventBox parent)
                        {
-                               parent.VisibleWindow = Page.CurrentPage?.Parent is Page parentPage
-                                       ? parentPage.BackgroundImageSource.IsEmpty
-                                       : true;
+                               if (Page.CurrentPage?.Parent is Page parentPage && parentPage.BackgroundImageSource != null)
+                               {
+                                       parent.VisibleWindow = parentPage.BackgroundImageSource.IsEmpty;
+                               }
+                               else
+                               {
+                                       parent.VisibleWindow = true;
+                               }
                        }
                }