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
|
static void
|
||||||
hist_prev (WInput *in)
|
hist_prev (WInput *in)
|
||||||
{
|
{
|
||||||
|
GList *prev;
|
||||||
|
|
||||||
if (!in->history)
|
if (!in->history)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (in->need_push) {
|
if (in->need_push)
|
||||||
push_history (in, in->buffer);
|
push_history (in, in->buffer);
|
||||||
in->history = g_list_previous (in->history);
|
|
||||||
} else if (in->history->prev)
|
prev = g_list_previous (in->history);
|
||||||
in->history = g_list_previous (in->history);
|
if (prev != NULL) {
|
||||||
else
|
in->history = prev;
|
||||||
return;
|
assign_text (in, (char *) prev->data);
|
||||||
assign_text (in, (char *) in->history->data);
|
in->need_push = 0;
|
||||||
in->need_push = 0;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user