From 1f8fce206dc657a04694f8b546df5d1fe1ca1856 Mon Sep 17 00:00:00 2001 From: Jakub Wojciech Date: Sun, 20 Dec 2020 10:56:51 +0100 Subject: [PATCH] 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. --- guile-readline/readline.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 -- 2.29.2