Skip to content

Commit c621134

Browse files
committed
Merge branch '4627_help_segfault'
* 4627_help_segfault: Ticket #4627: fix segfault in the help engine
2 parents da12b1a + 8d53fff commit c621134

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/help.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ typedef struct Link_Area
9696

9797
static char *fdata = NULL; /* Pointer to the loaded data file */
9898
static int help_lines; /* Lines in help viewer */
99-
static int history_ptr; /* For the history queue */
99+
static int history_ptr = 0; /* For the history queue */
100100
static const char *main_node; /* The main node */
101101
static const char *last_shown = NULL; /* Last byte shown in a screen */
102102
static gboolean end_of_node = FALSE; /* Flag: the last character of the node shown? */
@@ -1091,6 +1091,7 @@ help_interactive_display (const gchar *event_group_name, const gchar *event_name
10911091
char *filedata;
10921092
ev_help_t *event_data = (ev_help_t *) data;
10931093
WRect r = { 1, 1, 1, 1 };
1094+
int i;
10941095

10951096
(void) event_group_name;
10961097
(void) event_name;
@@ -1150,10 +1151,10 @@ help_interactive_display (const gchar *event_group_name, const gchar *event_name
11501151
selected_item = search_string_node (main_node, STRING_LINK_START) - 1;
11511152
currentpoint = main_node + 1; /* Skip the newline following the start of the node */
11521153

1153-
for (history_ptr = HISTORY_SIZE - 1; history_ptr >= 0; history_ptr--)
1154+
for (i = HISTORY_SIZE - 1; i >= 0; i--)
11541155
{
1155-
history[history_ptr].page = currentpoint;
1156-
history[history_ptr].link = selected_item;
1156+
history[i].page = currentpoint;
1157+
history[i].link = selected_item;
11571158
}
11581159

11591160
help_bar = buttonbar_new ();

0 commit comments

Comments
 (0)