[PATCH] [WinHlp32]: better protect macros againts not finding a help file

Eric Pouech eric.pouech at orange.fr
Sun Jul 31 01:53:34 CDT 2011




A+
---

 programs/winhlp32/macro.c |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)


diff --git a/programs/winhlp32/macro.c b/programs/winhlp32/macro.c
index 7f3328f..0a1642c 100644
--- a/programs/winhlp32/macro.c
+++ b/programs/winhlp32/macro.c
@@ -575,11 +575,11 @@ void CALLBACK MACRO_JumpContext(LPCSTR lpszPath, LPCSTR lpszWindow, LONG context
     HLPFILE*    hlpfile;
 
     WINE_TRACE("(\"%s\", \"%s\", %d)\n", lpszPath, lpszWindow, context);
-    hlpfile = WINHELP_LookupHelpFile(lpszPath);
-    /* Some madness: what user calls 'context', hlpfile calls 'map' */
-    WINHELP_OpenHelpWindow(HLPFILE_PageByMap, hlpfile, context,
-                           WINHELP_GetWindowInfo(hlpfile, lpszWindow),
-                           SW_NORMAL);
+    if ((hlpfile = WINHELP_LookupHelpFile(lpszPath)))
+        /* Some madness: what user calls 'context', hlpfile calls 'map' */
+        WINHELP_OpenHelpWindow(HLPFILE_PageByMap, hlpfile, context,
+                               WINHELP_GetWindowInfo(hlpfile, lpszWindow),
+                               SW_NORMAL);
 }
 
 void CALLBACK MACRO_JumpHash(LPCSTR lpszPath, LPCSTR lpszWindow, LONG lHash)
@@ -591,9 +591,10 @@ void CALLBACK MACRO_JumpHash(LPCSTR lpszPath, LPCSTR lpszWindow, LONG lHash)
         hlpfile = MACRO_CurrentWindow()->page->file;
     else
         hlpfile = WINHELP_LookupHelpFile(lpszPath);
-    WINHELP_OpenHelpWindow(HLPFILE_PageByHash, hlpfile, lHash,
-                           WINHELP_GetWindowInfo(hlpfile, lpszWindow),
-                           SW_NORMAL);
+    if (hlpfile)
+        WINHELP_OpenHelpWindow(HLPFILE_PageByHash, hlpfile, lHash,
+                               WINHELP_GetWindowInfo(hlpfile, lpszWindow),
+                               SW_NORMAL);
 }
 
 static void CALLBACK MACRO_JumpHelpOn(void)




More information about the wine-patches mailing list