Browse Source

Fix out of range crashes

Ruben 7 months ago
parent
commit
3bfc5f13f9
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/PicView.Avalonia/Gallery/GalleryFunctions.cs

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

@@ -260,7 +260,7 @@ public static class GalleryFunctions
             var mainView = UIHelper.GetMainView;
 
             var galleryListBox = mainView.GalleryView.GalleryListBox;
-            if (vm.SelectedGalleryItemIndex < 0)
+            if (vm.SelectedGalleryItemIndex < 0 || vm.SelectedGalleryItemIndex >= galleryListBox.Items.Count)
             {
                 return;
             }