mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 12:56:51 +03:00
Ticket #1936: segfault in input line history.
If input line history contains only one item, pressing M-p ("Previous history item") causes a segmentation fault. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
287255b2ed
commit
6d9e319106
18
src/widget.c
18
src/widget.c
@ -1702,18 +1702,20 @@ assign_text (WInput *in, const char *text)
|
||||
static void
|
||||
hist_prev (WInput *in)
|
||||
{
|
||||
GList *prev;
|
||||
|
||||
if (!in->history)
|
||||
return;
|
||||
|
||||
if (in->need_push) {
|
||||
if (in->need_push)
|
||||
push_history (in, in->buffer);
|
||||
in->history = g_list_previous (in->history);
|
||||
} else if (in->history->prev)
|
||||
in->history = g_list_previous (in->history);
|
||||
else
|
||||
return;
|
||||
assign_text (in, (char *) in->history->data);
|
||||
in->need_push = 0;
|
||||
|
||||
prev = g_list_previous (in->history);
|
||||
if (prev != NULL) {
|
||||
in->history = prev;
|
||||
assign_text (in, (char *) prev->data);
|
||||
in->need_push = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user