diff options
author | John Hawthorn <john.hawthorn@gmail.com> | 2016-07-03 22:51:35 -0700 |
---|---|---|
committer | John Hawthorn <john.hawthorn@gmail.com> | 2016-07-12 00:42:48 -0700 |
commit | da86472d7399ff110baf819faad927703173b6d2 (patch) | |
tree | e12ff87c2a6398b167ec5f541c974f41e0cc2698 /src/tty_interface.c | |
parent | cf9bba88b3a384e49a91c52968db57c60dc454eb (diff) |
Fix segfault when autocompleting on no matches
Diffstat (limited to 'src/tty_interface.c')
-rw-r--r-- | src/tty_interface.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/tty_interface.c b/src/tty_interface.c index 0f33305..9ca93c1 100644 --- a/src/tty_interface.c +++ b/src/tty_interface.c @@ -166,7 +166,10 @@ static void action_pagedown(tty_interface_t *state) { static void action_autocomplete(tty_interface_t *state) { update_state(state); - strncpy(state->search, choices_get(state->choices, state->choices->selection), SEARCH_SIZE_MAX); + const char *current_selection = choices_get(state->choices, state->choices->selection); + if (current_selection) { + strncpy(state->search, choices_get(state->choices, state->choices->selection), SEARCH_SIZE_MAX); + } } static void action_exit(tty_interface_t *state) { |