- prevent crash when GetMenuDefaultItem is called on empty menu
- set default item on system menu
This commit is contained in:
parent
0a277b638c
commit
4925186bb2
|
@ -279,6 +279,7 @@ static HMENU MENU_CopySysPopup(void)
|
|||
if( hMenu ) {
|
||||
POPUPMENU* menu = (POPUPMENU *) USER_HEAP_LIN_ADDR(hMenu);
|
||||
menu->wFlags |= MF_SYSMENU | MF_POPUP;
|
||||
SetMenuDefaultItem(hMenu, SC_CLOSE, FALSE);
|
||||
}
|
||||
else {
|
||||
hMenu = 0;
|
||||
|
@ -4395,6 +4396,10 @@ UINT WINAPI GetMenuDefaultItem(HMENU hmenu, UINT bypos, UINT flags)
|
|||
|
||||
/* find default item */
|
||||
item = menu->items;
|
||||
|
||||
/* empty menu */
|
||||
if (! item) return -1;
|
||||
|
||||
while ( !( item->fState & MFS_DEFAULT ) )
|
||||
{
|
||||
i++; item++;
|
||||
|
|
Loading…
Reference in New Issue