From 482354bdf74daaac18f0c3b572e6e3f569f3fbd3 Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Tue, 1 Dec 2009 23:14:10 +0100 Subject: [PATCH] shell32: Check for NULL lpText (Coverity). --- dlls/shell32/shlmenu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dlls/shell32/shlmenu.c b/dlls/shell32/shlmenu.c index efdd6b59bbc..957711ff759 100644 --- a/dlls/shell32/shlmenu.c +++ b/dlls/shell32/shlmenu.c @@ -392,12 +392,15 @@ BOOL WINAPI FileMenu_AppendItemAW( { BOOL ret; - if ((SHELL_OsIsUnicode() && (lpText!=FM_SEPARATOR)) || (lpText == NULL)) + if (!lpText) return FALSE; + + if (SHELL_OsIsUnicode() || lpText == FM_SEPARATOR) ret = FileMenu_AppendItemW(hMenu, lpText, uID, icon, hMenuPopup, nItemHeight); else { DWORD len = MultiByteToWideChar( CP_ACP, 0, lpText, -1, NULL, 0 ); LPWSTR lpszText = HeapAlloc ( GetProcessHeap(), 0, len*sizeof(WCHAR) ); + if (!lpszText) return FALSE; MultiByteToWideChar( CP_ACP, 0, lpText, -1, lpszText, len ); ret = FileMenu_AppendItemW(hMenu, lpszText, uID, icon, hMenuPopup, nItemHeight); HeapFree( GetProcessHeap(), 0, lpszText );