* help.c (help_index_cmd): Eliminate unneeded search for

"[Help]", which always fails.  Fix crash if "[Contents]" cannot
be found.  Reuse more generic error message.
This commit is contained in:
Pavel Roskin 2002-09-03 07:15:01 +00:00
parent 52caab36b8
commit afae5939cd
2 changed files with 15 additions and 9 deletions

View File

@ -1,5 +1,9 @@
2002-09-03 Pavel Roskin <proski@gnu.org>
* help.c (help_index_cmd): Eliminate unneeded search for
"[Help]", which always fails. Fix crash if "[Contents]" cannot
be found. Reuse more generic error message.
* filegui.c: Eliminate x_set_dialog_title().
* hotlist.c: Likewise.
* help.c: Likewise.

View File

@ -556,19 +556,21 @@ help_help_cmd (Dlg_head *h)
}
static void
help_index_cmd (Dlg_head *h)
help_index_cmd (Dlg_head * h)
{
char *new_item;
history_ptr = (history_ptr+1) % HISTORY_SIZE;
history [history_ptr].page = currentpoint;
history [history_ptr].link = selected_item;
currentpoint = startpoint = search_string (data, "[Help]") + 1;
if (!(new_item = search_string (data, "[Contents]"))) {
message (1, MSG_ERROR, _(" Cannot find node %s in help file "),
"[Contents]");
return;
}
if (!(new_item = search_string (data, "[Contents]")))
message (1, MSG_ERROR, _(" Cannot find node [Contents] in help file "));
else
currentpoint = startpoint = new_item + 1;
history_ptr = (history_ptr + 1) % HISTORY_SIZE;
history[history_ptr].page = currentpoint;
history[history_ptr].link = selected_item;
currentpoint = startpoint = new_item + 1;
selected_item = NULL;
help_callback (h, 0, DLG_DRAW);
}