From 2c7a1477ef63968614693768b56888b5093d3e87 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Sat, 20 Dec 2008 15:32:00 +0000 Subject: [PATCH] implemented some stability checks into ShowErrorHelpCommand git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@3701 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../src/Commands/ShowErrorHelpCommand.cs | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/AddIns/Misc/HtmlHelp2/Project/src/Commands/ShowErrorHelpCommand.cs b/src/AddIns/Misc/HtmlHelp2/Project/src/Commands/ShowErrorHelpCommand.cs index 5ae1cc5c4f..80d6e86d4b 100644 --- a/src/AddIns/Misc/HtmlHelp2/Project/src/Commands/ShowErrorHelpCommand.cs +++ b/src/AddIns/Misc/HtmlHelp2/Project/src/Commands/ShowErrorHelpCommand.cs @@ -19,7 +19,6 @@ namespace HtmlHelp2.Commands /// public class ShowErrorHelpCommand : AbstractMenuCommand { - AxMSHelpControls.AxHxIndexCtrl indexControl; /// /// Starts the command /// @@ -42,11 +41,24 @@ namespace HtmlHelp2.Commands if (HtmlHelp2.Environment.HtmlHelp2Environment.SessionIsInitialized) { // Get the topic - IHxIndex index = HtmlHelp2.Environment.HtmlHelp2Environment.GetIndex(HtmlHelp2.Environment.HtmlHelp2Environment.CurrentFilterQuery); + IHxIndex index = HtmlHelp2.Environment.HtmlHelp2Environment.GetIndex(""); + if (index == null) { + MessageService.ShowErrorFormatted("No help available for {0}!", code); + return; + } int indexSlot = index.GetSlotFromString(code); - topic = index.GetTopicsFromSlot(indexSlot).ItemAt(1); + IHxTopicList list = index.GetTopicsFromSlot(indexSlot); + if (list == null) { + MessageService.ShowErrorFormatted("No help available for {0}!", code); + return; + } + topic = list.ItemAt(1); + if (topic == null) { + MessageService.ShowErrorFormatted("No help available for {0}!", code); + return; + } string topicTitle = topic.get_Title(HxTopicGetTitleType.HxTopicGetTOCTitle, HxTopicGetTitleDefVal.HxTopicGetTitleFileName); - if (!topicTitle.Contains(code)) { + if (topicTitle == null || !topicTitle.Contains(code)) { MessageService.ShowErrorFormatted("No help available for {0}!", code); return; }