浏览代码

Fix out of range crashes

Ruben 7 月之前
父节点
当前提交
3bfc5f13f9
共有 1 个文件被更改,包括 1 次插入1 次删除
  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;
             }