[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
This commit is contained in:
Don Ho 2011-11-06 16:44:39 +00:00
parent f35cd62e88
commit 117136e341

View File

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