- prevent crash when GetMenuDefaultItem is called on empty menu

- set default item on system menu
This commit is contained in:
Juergen Schmied 1999-05-13 18:42:03 +00:00 committed by Alexandre Julliard
parent 0a277b638c
commit 4925186bb2
1 changed files with 5 additions and 0 deletions

View File

@ -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++;