hhctrl: Fix NULL pointer dereference in some failure cases.
authorTijl Coosemans <tijl@ulyssis.org>
Mon, 28 Apr 2008 20:41:47 +0000 (22:41 +0200)
committerAlexandre Julliard <julliard@winehq.org>
Tue, 29 Apr 2008 11:48:30 +0000 (13:48 +0200)
dlls/hhctrl.ocx/hhctrl.c

index e663c11803838a70dfbc8df06e0f8a723d549ac2..a555a42763d26f472542c0370f4e1cfa5aaf8f15 100644 (file)
@@ -123,14 +123,17 @@ HWND WINAPI HtmlHelpW(HWND caller, LPCWSTR filename, UINT command, DWORD_PTR dat
         }
 
         info = CreateHelpViewer(filename);
+        if(!info)
+            return NULL;
+
+        if(!index)
+            index = info->WinType.pszFile;
 
-        if (info)
+        res = NavigateToChm(info, info->pCHMInfo->szFile, index);
+        if(!res)
         {
-            if (!index)
-                index = info->WinType.pszFile;
-            res = NavigateToChm(info, info->pCHMInfo->szFile, index);
-            if(!res)
-                ReleaseHelpViewer(info);
+            ReleaseHelpViewer(info);
+            return NULL;
         }
         return info->WinType.hwndHelp;
     }