Commit 52373b2d authored by Richard Cohen's avatar Richard Cohen Committed by Alexandre Julliard

MenuItemFromPoint shouldn't crash if there's no menu.

parent 48dc3164
...@@ -633,7 +633,7 @@ static void MENU_FreeItemData( MENUITEM* item ) ...@@ -633,7 +633,7 @@ static void MENU_FreeItemData( MENUITEM* item )
* not work for child windows and therefore should not be called for * not work for child windows and therefore should not be called for
* an arbitrary system menu. * an arbitrary system menu.
*/ */
static MENUITEM *MENU_FindItemByCoords( POPUPMENU *menu, static MENUITEM *MENU_FindItemByCoords( const POPUPMENU *menu,
POINT pt, UINT *pos ) POINT pt, UINT *pos )
{ {
MENUITEM *item; MENUITEM *item;
...@@ -4500,15 +4500,14 @@ DWORD WINAPI GetMenuContextHelpId( HMENU hMenu ) ...@@ -4500,15 +4500,14 @@ DWORD WINAPI GetMenuContextHelpId( HMENU hMenu )
/********************************************************************** /**********************************************************************
* MenuItemFromPoint (USER32.@) * MenuItemFromPoint (USER32.@)
*/ */
UINT WINAPI MenuItemFromPoint(HWND hWnd, HMENU hMenu, POINT ptScreen) INT WINAPI MenuItemFromPoint(HWND hWnd, HMENU hMenu, POINT ptScreen)
{ {
POPUPMENU *menu = MENU_GetMenu(hMenu); POPUPMENU *menu = MENU_GetMenu(hMenu);
UINT pos; UINT pos;
MENUITEM *item;
/*FIXME: Do we have to handle hWnd here? */ /*FIXME: Do we have to handle hWnd here? */
item = MENU_FindItemByCoords(menu, ptScreen, &pos); if (!menu) return -1;
if (!MENU_FindItemByCoords(menu, ptScreen, &pos)) return -1;
return pos; return pos;
} }
......
...@@ -4336,7 +4336,7 @@ UINT WINAPI MapVirtualKeyExW(UINT,UINT,HKL); ...@@ -4336,7 +4336,7 @@ UINT WINAPI MapVirtualKeyExW(UINT,UINT,HKL);
#define MapVirtualKeyEx WINELIB_NAME_AW(MapVirtualKeyEx) #define MapVirtualKeyEx WINELIB_NAME_AW(MapVirtualKeyEx)
BOOL WINAPI MapDialogRect(HWND,LPRECT); BOOL WINAPI MapDialogRect(HWND,LPRECT);
INT WINAPI MapWindowPoints(HWND,HWND,LPPOINT,UINT); INT WINAPI MapWindowPoints(HWND,HWND,LPPOINT,UINT);
UINT WINAPI MenuItemFromPoint(HWND,HMENU,POINT); INT WINAPI MenuItemFromPoint(HWND,HMENU,POINT);
BOOL WINAPI MessageBeep(UINT); BOOL WINAPI MessageBeep(UINT);
INT WINAPI MessageBoxA(HWND,LPCSTR,LPCSTR,UINT); INT WINAPI MessageBoxA(HWND,LPCSTR,LPCSTR,UINT);
INT WINAPI MessageBoxW(HWND,LPCWSTR,LPCWSTR,UINT); INT WINAPI MessageBoxW(HWND,LPCWSTR,LPCWSTR,UINT);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment