[USER32] Improve the check for item in MENU_FindItem().
authorAmine Khaldi <amine.khaldi@reactos.org>
Tue, 10 Nov 2015 12:11:10 +0000 (12:11 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Tue, 10 Nov 2015 12:11:10 +0000 (12:11 +0000)
svn path=/trunk/; revision=69861

reactos/win32ss/user/user32/windows/menu.c

index 7e0eb58..a83666f 100644 (file)
@@ -110,7 +110,7 @@ ITEM *MENU_FindItem( HMENU *hmenu, UINT *nPos, UINT wFlags )
     else
     {
         PITEM item = menu->rgItems ? DesktopPtrToUser(menu->rgItems) : NULL;
     else
     {
         PITEM item = menu->rgItems ? DesktopPtrToUser(menu->rgItems) : NULL;
-       for (i = 0; item, i < menu->cItems; i++, item++)
+       for (i = 0; item && (i < menu->cItems); i++, item++)
        {
            if (item->spSubMenu)
            {
        {
            if (item->spSubMenu)
            {