Ruben 7 miesięcy temu
rodzic
commit
478bccd76b
1 zmienionych plików z 4 dodań i 4 usunięć
  1. 4 4
      src/PicView.Avalonia/Gallery/GalleryFunctions.cs

+ 4 - 4
src/PicView.Avalonia/Gallery/GalleryFunctions.cs

@@ -198,9 +198,6 @@ public static class GalleryFunctions
         {
             Dispatcher.UIThread.Post(ClearItems);
         }
-#if DEBUG
-        Console.WriteLine("Gallery items cleared");
-#endif
 
         return;
 
@@ -210,7 +207,7 @@ public static class GalleryFunctions
             {
                 var mainView = UIHelper.GetMainView;
 
-                var galleryListBox = mainView.GalleryView.GalleryListBox;
+                var galleryListBox = mainView?.GalleryView.GalleryListBox;
                 if (galleryListBox == null)
                 {
                     return;
@@ -232,6 +229,9 @@ public static class GalleryFunctions
                 }
 
                 galleryListBox.Items.Clear();
+#if DEBUG
+                Console.WriteLine("Gallery items cleared");
+#endif
             }
             catch (Exception e)
             {