fzy

terminal fuzzy finder picker

git clone https://9o.is/git/fzy.git

commit eca3c7b05feadfefd3387611e0519a87a3703aec
parent 362370baf7d98c0298851afe6afed0283a118959
Author: John Hawthorn <john.hawthorn@gmail.com>
Date:   Sun,  3 Jul 2016 22:51:35 -0700

Fix segfault when autocompleting on no matches

Diffstat:
MCHANGELOG.md | 1+
Msrc/tty_interface.c | 5++++-
2 files changed, 5 insertions(+), 1 deletion(-)

diff --git 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 @@ -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) {