dll/win32/shell32/CDefView.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dll/win32/shell32/CDefView.cpp b/dll/win32/shell32/CDefView.cpp index a152ac6c263..60fc08b8c7c 100644 --- a/dll/win32/shell32/CDefView.cpp +++ b/dll/win32/shell32/CDefView.cpp @@ -1306,6 +1306,7 @@ UINT ReallyGetMenuItemID(HMENU hmenu, int i) HRESULT CDefView::FillFileMenu() { + HRESULT hr; HMENU hFileMenu = GetSubmenuByID(m_hMenu, FCIDM_MENU_FILE); if (!hFileMenu) return E_FAIL; @@ -1321,7 +1322,8 @@ HRESULT CDefView::FillFileMenu() m_cidl = m_ListView.GetSelectedCount(); /* Store the context menu in m_pCM and keep it in order to invoke the selected command later on */ - HRESULT hr = GetItemObject((m_cidl ? SVGIO_SELECTION : SVGIO_BACKGROUND), + if (m_pCM == NULL) + hr = GetItemObject((m_cidl ? SVGIO_SELECTION : SVGIO_BACKGROUND), IID_PPV_ARG(IContextMenu, &m_pCM)); if (FAILED_UNEXPECTEDLY(hr)) return hr;