From 33c1d06c5a46f84809d65e35560b6fcebf485fcf Mon Sep 17 00:00:00 2001 From: Ruben Date: Wed, 3 Nov 2021 19:48:51 +0100 Subject: [PATCH] Fix context menu crash when loading from single image --- PicView/ChangeImage/History.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/PicView/ChangeImage/History.cs b/PicView/ChangeImage/History.cs index f10eff61c..59bcef8e5 100644 --- a/PicView/ChangeImage/History.cs +++ b/PicView/ChangeImage/History.cs @@ -175,6 +175,11 @@ internal static void RefreshRecentItemsMenu() var cm = (MenuItem)ConfigureWindows.MainContextMenu.Items[5]; for (int i = 0; i < maxCount; i++) { + if (fileHistory.Count == i) + { + return; + } + var item = menuItem(fileHistory[i], i); if (item is null) { break; } if (cm.Items.Count <= i)