[PATCH] shell32: handle bad menu handle (Coverity)

Marcus Meissner meissner at suse.de
Sat Jan 9 07:59:22 CST 2010


Hi,

handle "invalid menu" return -1.

Ciao, Marcus
---
 dlls/shell32/shlmenu.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/dlls/shell32/shlmenu.c b/dlls/shell32/shlmenu.c
index 957711f..aea319c 100644
--- a/dlls/shell32/shlmenu.c
+++ b/dlls/shell32/shlmenu.c
@@ -869,10 +869,11 @@ HRESULT WINAPI Shell_MergeMenus (HMENU hmDst, HMENU hmSrc, UINT uInsert, UINT uI
 		 hmDst, hmSrc, uInsert, uIDAdjust, uIDAdjustMax, uFlags);
 
 	if (!hmDst || !hmSrc)
-	{ return uIDMax;
-	}
+	  return uIDMax;
 
 	nItem = GetMenuItemCount(hmDst);
+        if (nItem == -1)
+	  return uIDMax;
 
 	if (uInsert >= (UINT)nItem)	/* insert position inside menu? */
 	{
-- 
1.6.4.2



More information about the wine-patches mailing list