Browse Source

implemented some stability checks into ShowErrorHelpCommand

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@3701 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Siegfried Pammer 17 years ago
parent
commit
2c7a1477ef
  1. 20
      src/AddIns/Misc/HtmlHelp2/Project/src/Commands/ShowErrorHelpCommand.cs

20
src/AddIns/Misc/HtmlHelp2/Project/src/Commands/ShowErrorHelpCommand.cs

@ -19,7 +19,6 @@ namespace HtmlHelp2.Commands
/// </summary> /// </summary>
public class ShowErrorHelpCommand : AbstractMenuCommand public class ShowErrorHelpCommand : AbstractMenuCommand
{ {
AxMSHelpControls.AxHxIndexCtrl indexControl;
/// <summary> /// <summary>
/// Starts the command /// Starts the command
/// </summary> /// </summary>
@ -42,11 +41,24 @@ namespace HtmlHelp2.Commands
if (HtmlHelp2.Environment.HtmlHelp2Environment.SessionIsInitialized) if (HtmlHelp2.Environment.HtmlHelp2Environment.SessionIsInitialized)
{ {
// Get the topic // 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); 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); 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); MessageService.ShowErrorFormatted("No help available for {0}!", code);
return; return;
} }

Loading…
Cancel
Save