diff --git a/src/AddIns/Misc/HtmlHelp2/Project/src/Commands/ShowErrorHelpCommand.cs b/src/AddIns/Misc/HtmlHelp2/Project/src/Commands/ShowErrorHelpCommand.cs index 80d6e86d4b..553d909ad8 100644 --- a/src/AddIns/Misc/HtmlHelp2/Project/src/Commands/ShowErrorHelpCommand.cs +++ b/src/AddIns/Misc/HtmlHelp2/Project/src/Commands/ShowErrorHelpCommand.cs @@ -4,6 +4,7 @@ // // $Revision: 3555 $ // + using MSHelpServices; using System; using System.Collections.Generic; @@ -15,7 +16,7 @@ using ICSharpCode.SharpDevelop.Gui; namespace HtmlHelp2.Commands { /// - /// Description of ShowErrorHelpCommand + /// Shows help information for an error in the Errors window. /// public class ShowErrorHelpCommand : AbstractMenuCommand { @@ -27,8 +28,7 @@ namespace HtmlHelp2.Commands ICSharpCode.SharpDevelop.Gui.TaskView view = (ICSharpCode.SharpDevelop.Gui.TaskView)Owner; // Search all selected tasks - foreach (Task t in new List(view.SelectedTasks)) - { + foreach (Task t in new List(view.SelectedTasks)) { string code = t.BuildError.ErrorCode; if (string.IsNullOrEmpty(code)) @@ -38,8 +38,7 @@ namespace HtmlHelp2.Commands MSHelpServices.IHxTopic topic; // If HtmlHelp2 AddIn is initialised correctly we can start! - if (HtmlHelp2.Environment.HtmlHelp2Environment.SessionIsInitialized) - { + if (HtmlHelp2.Environment.HtmlHelp2Environment.SessionIsInitialized) { // Get the topic IHxIndex index = HtmlHelp2.Environment.HtmlHelp2Environment.GetIndex(""); if (index == null) { @@ -47,6 +46,10 @@ namespace HtmlHelp2.Commands return; } int indexSlot = index.GetSlotFromString(code); + if (indexSlot <= 0) { + MessageService.ShowErrorFormatted("No help available for {0}!", code); + return; + } IHxTopicList list = index.GetTopicsFromSlot(indexSlot); if (list == null) { MessageService.ShowErrorFormatted("No help available for {0}!", code); @@ -62,9 +65,7 @@ namespace HtmlHelp2.Commands MessageService.ShowErrorFormatted("No help available for {0}!", code); return; } - } - else // Otherwise we have to show an Error message ... - { + } else { // Otherwise we have to show an Error message ... LoggingService.Error("Couldn't initialize help database"); return; }