From c28b2cd09d135ed8d13d558e242aa1de10dc7e8e Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Sun, 1 Aug 2010 13:49:51 +0000 Subject: [PATCH] Avoid ArgumentNullException(Help3Service.ActiveCatalog) when pressing F1 on machine without Windows SDK 7.1 installed. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@6346 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- src/AddIns/Misc/HelpViewer/Source/Core/DisplayHelp.cs | 11 ++++++----- src/AddIns/Misc/HelpViewer/Source/MSHelp3Provider.cs | 3 +-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/AddIns/Misc/HelpViewer/Source/Core/DisplayHelp.cs b/src/AddIns/Misc/HelpViewer/Source/Core/DisplayHelp.cs index a3ec8127c1..2e2618eb49 100644 --- a/src/AddIns/Misc/HelpViewer/Source/Core/DisplayHelp.cs +++ b/src/AddIns/Misc/HelpViewer/Source/Core/DisplayHelp.cs @@ -54,21 +54,22 @@ namespace MSHelpSystem.Core DisplayLocalHelp(helpPageUrl); } - public static void ContextualHelp(string contextual) + public static bool ContextualHelp(string contextual) { if (string.IsNullOrEmpty(contextual)) { throw new ArgumentNullException("contextual"); } if (!Help3Environment.IsLocalHelp) { DisplayHelpOnMSDN(contextual); - return; + return true; } if (Help3Service.ActiveCatalog == null) { - throw new ArgumentNullException("Help3Service.ActiveCatalog"); + return false; } string helpContextualUrl = string.Format(@"ms-xhelp://?method=f1&query={1}&{0}", Help3Service.ActiveCatalog.AsMsXHelpParam, contextual); LoggingService.Debug(string.Format("Help 3.0: {0}", helpContextualUrl)); DisplayLocalHelp(helpContextualUrl); + return true; } public static void Search(string searchWords) @@ -136,7 +137,7 @@ namespace MSHelpSystem.Core LoggingService.Info(string.Format("Help 3.0: Navigating to {0}", helpUrl)); browser.Navigate(Help3Environment.GetHttpFromMsXHelp(helpUrl)); browser.WorkbenchWindow.SelectWindow(); - } + } } static void DisplayHelpWithShellExecute(string arguments) @@ -206,6 +207,6 @@ namespace MSHelpSystem.Core BrowserPane tmp = new BrowserPane(); WorkbenchSingleton.Workbench.ShowView(tmp); return tmp; - } + } } } diff --git a/src/AddIns/Misc/HelpViewer/Source/MSHelp3Provider.cs b/src/AddIns/Misc/HelpViewer/Source/MSHelp3Provider.cs index 6b945386e6..bcf8dd1e25 100644 --- a/src/AddIns/Misc/HelpViewer/Source/MSHelp3Provider.cs +++ b/src/AddIns/Misc/HelpViewer/Source/MSHelp3Provider.cs @@ -13,8 +13,7 @@ namespace MSHelpSystem throw new ArgumentNullException("fullTypeName"); } LoggingService.Info(string.Format("Help 3.0: Calling \"TryShowHelp\" with {0}", fullTypeName)); - DisplayHelp.ContextualHelp(fullTypeName); - return true; + return DisplayHelp.ContextualHelp(fullTypeName); } public override bool TryShowHelpByKeyword(string keyword)