summaryrefslogtreecommitdiff
path: root/src/tty_interface.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tty_interface.c')
-rw-r--r--src/tty_interface.c5
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) {