- check if the requested MenuItem object was really found

- makes user32_winetest not crash reactos

svn path=/trunk/; revision=33361
This commit is contained in:
Johannes Anderwald 2008-05-08 07:46:46 +00:00
parent 89ac2632f2
commit 6208860a11

View file

@ -930,7 +930,7 @@ IntInsertMenuItem(PMENU_OBJECT MenuObject, UINT uItem, BOOL fByPosition,
{ {
int pos = (int)uItem; int pos = (int)uItem;
PMENU_ITEM MenuItem; PMENU_ITEM MenuItem;
PMENU_OBJECT SubMenu; PMENU_OBJECT SubMenu = NULL;
if (MAX_MENU_ITEMS <= MenuObject->MenuInfo.MenuItemCount) if (MAX_MENU_ITEMS <= MenuObject->MenuInfo.MenuItemCount)
{ {
@ -951,6 +951,13 @@ IntInsertMenuItem(PMENU_OBJECT MenuObject, UINT uItem, BOOL fByPosition,
{ {
pos = IntGetMenuItemByFlag(MenuObject, uItem, MF_BYCOMMAND, &SubMenu, NULL, NULL); pos = IntGetMenuItemByFlag(MenuObject, uItem, MF_BYCOMMAND, &SubMenu, NULL, NULL);
} }
if (SubMenu == NULL)
{
SetLastWin32Error(ERROR_INVALID_PARAMETER);
return FALSE;
}
if (pos < -1) if (pos < -1)
{ {
pos = -1; pos = -1;