summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Wojciech <jakub-w@riseup.net>2020-12-20 10:56:51 +0100
committerDaniel Llorens <lloda@sarc.name>2021-05-19 15:45:05 +0200
commit02439a12406cbfb9214af2665dfd70986363eeb1 (patch)
tree5c94861532fb2e6cc5214ba4e662e298ccd0826e
parent221203b0df6420b0b8e7678fab7d056325364731 (diff)
downloadguile-02439a12406cbfb9214af2665dfd70986363eeb1.tar.gz
Fixed filename-completion-function for readline completion
* guile-readline/readline.c (scm_filename_completion_function): A completion function should return #f when there's no more candidates. Since the result of readline's rl_filename_completion_function was never checked it was impossible for it to work as intended and instead of #f it threw an error from trying to convert NULL to an scm string.
-rw-r--r--guile-readline/readline.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/guile-readline/readline.c b/guile-readline/readline.c
index 5c4a32689..7bb2394ba 100644
--- a/guile-readline/readline.c
+++ b/guile-readline/readline.c
@@ -386,8 +386,11 @@ SCM_DEFINE (scm_filename_completion_function, "filename-completion-function", 2,
#else
s = filename_completion_function (c_text, scm_is_true (continuep));
#endif
- ans = scm_take_locale_string (s);
free (c_text);
+ if (!s) {
+ return SCM_BOOL_F;
+ }
+ ans = scm_take_locale_string (s);
return ans;
}
#undef FUNC_NAME