OSDN Git Service

FolderCompare: Fix crash when pressing Shift+F10 to show the context menu when there...
authorTakashi Sawanaka <sdottaka@users.sourceforge.net>
Tue, 29 Nov 2022 14:29:38 +0000 (23:29 +0900)
committerTakashi Sawanaka <sdottaka@users.sourceforge.net>
Tue, 29 Nov 2022 14:29:38 +0000 (23:29 +0900)
Src/DirView.cpp

index 300a749..8db97ef 100644 (file)
@@ -703,6 +703,10 @@ void CDirView::ListContextMenu(CPoint point, int /*i*/)
        ASSERT(pPopup != nullptr);
 
        int sel = GetFocusedItem();
+       if (sel == -1)
+               sel = GetFirstSelectedInd();
+       if (sel == -1)
+               return;
        const DIFFITEM& di = GetDiffItem(sel);
        if (GetDiffContext().m_bRecursive && di.diffcode.isDirectory())
                pPopup->RemoveMenu(ID_MERGE_COMPARE, MF_BYCOMMAND);