Skip to content

Commit

Permalink
Fixed a crash when calling the InvokeDefaultShellContextMenuCommand w…
Browse files Browse the repository at this point in the history
…ith an empty TreeViewItems or TreeViewItemContainer collection.
  • Loading branch information
TimoKunze committed Feb 2, 2018
1 parent 928968c commit e1699dd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/ctlinterfaces/extvw/ShellTreeView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2297,11 +2297,11 @@ STDMETHODIMP ShellTreeView::CreateShellContextMenu(VARIANT items, OLE_HANDLE* pM
HTREEITEM* pItems = NULL;
hr = VariantToItemHandles(items, pItems, itemCount);
if(SUCCEEDED(hr)) {
HMENU hMenu = NULL;
if(itemCount > 0) {
ATLASSERT_ARRAYPOINTER(pItems, LONG, itemCount);
hr = CreateShellContextMenu(pItems, itemCount, CMF_NORMAL, hMenu);
}
HMENU hMenu = NULL;
hr = CreateShellContextMenu(pItems, itemCount, CMF_NORMAL, hMenu);
*pMenu = HandleToLong(hMenu);
}
if(pItems) {
Expand Down Expand Up @@ -2510,8 +2510,8 @@ STDMETHODIMP ShellTreeView::DisplayShellContextMenu(VARIANT items, OLE_XPOS_PIXE
if(SUCCEEDED(hr)) {
if(itemCount > 0) {
ATLASSERT_ARRAYPOINTER(pItems, LONG, itemCount);
hr = DisplayShellContextMenu(pItems, itemCount, position);
}
hr = DisplayShellContextMenu(pItems, itemCount, position);
}
if(pItems) {
delete[] pItems;
Expand Down Expand Up @@ -2926,8 +2926,8 @@ STDMETHODIMP ShellTreeView::InvokeDefaultShellContextMenuCommand(VARIANT items)
if(SUCCEEDED(hr)) {
if(itemCount > 0) {
ATLASSERT_ARRAYPOINTER(pItems, LONG, itemCount);
hr = InvokeDefaultShellContextMenuCommand(pItems, itemCount);
}
hr = InvokeDefaultShellContextMenuCommand(pItems, itemCount);
}
if(pItems) {
HeapFree(GetProcessHeap(), 0, pItems);
Expand Down

0 comments on commit e1699dd

Please sign in to comment.