[BUG_FIXED] Fix a crash issue while right-clicking on the doc switcher's column control ("Name" and "Ext.").

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@840 f5eea248-9336-0410-98b8-ebc06183d4e3
remotes/trunk
Don Ho 13 years ago
parent f35cd62e88
commit 117136e341

@ -66,10 +66,8 @@ BOOL CALLBACK VerticalFileSwitcher::run_dlgProc(UINT message, WPARAM wParam, LPA
{ {
LPNMITEMACTIVATE lpnmitem = (LPNMITEMACTIVATE) lParam; LPNMITEMACTIVATE lpnmitem = (LPNMITEMACTIVATE) lParam;
int i = lpnmitem->iItem; int i = lpnmitem->iItem;
if (i == -1) if (i == -1)
{ {
//::MessageBoxA(NULL, "oh yeh","",MB_OK);
::SendMessage(_hParent, WM_COMMAND, IDM_FILE_NEW, 0); ::SendMessage(_hParent, WM_COMMAND, IDM_FILE_NEW, 0);
} }
return TRUE; return TRUE;
@ -78,9 +76,9 @@ BOOL CALLBACK VerticalFileSwitcher::run_dlgProc(UINT message, WPARAM wParam, LPA
case NM_CLICK: case NM_CLICK:
{ {
LPNMITEMACTIVATE lpnmitem = (LPNMITEMACTIVATE) lParam; LPNMITEMACTIVATE lpnmitem = (LPNMITEMACTIVATE) lParam;
int nbItem = ListView_GetItemCount(_fileListView.getHSelf());
int i = lpnmitem->iItem; int i = lpnmitem->iItem;
if (i == -1 || i >= nbItem)
if (i == -1)
return TRUE; return TRUE;
LVITEM item; LVITEM item;
@ -97,8 +95,9 @@ BOOL CALLBACK VerticalFileSwitcher::run_dlgProc(UINT message, WPARAM wParam, LPA
{ {
// Switch to the right document // Switch to the right document
LPNMITEMACTIVATE lpnmitem = (LPNMITEMACTIVATE) lParam; LPNMITEMACTIVATE lpnmitem = (LPNMITEMACTIVATE) lParam;
int nbItem = ListView_GetItemCount(_fileListView.getHSelf());
int i = lpnmitem->iItem; int i = lpnmitem->iItem;
if (i == -1) if (i == -1 || i >= nbItem)
return TRUE; return TRUE;
LVITEM item; LVITEM item;
@ -143,7 +142,6 @@ BOOL CALLBACK VerticalFileSwitcher::run_dlgProc(UINT message, WPARAM wParam, LPA
case VK_RETURN: case VK_RETURN:
{ {
int i = ListView_GetSelectionMark(_fileListView.getHSelf()); int i = ListView_GetSelectionMark(_fileListView.getHSelf());
if (i == -1) if (i == -1)
return TRUE; return TRUE;

Loading…
Cancel
Save