summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md1
-rw-r--r--src/tty_interface.c5
2 files changed, 5 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 085f002..ca93562 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,7 @@ Performance:
Bugfixes:
- Fixed command line parsing on ARM
+ - Fix error when autocompleting and there are no matches
## 0.5 (2016-06-11)
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) {