|
@@ -126,12 +126,14 @@ void clish_shell_param_generator(clish_shell_t *this, lub_argv_t *matches,
|
|
|
char *saveptr;
|
|
|
str = clish_shell_expand(
|
|
|
clish_param__get_completion(param), SHELL_VAR_ACTION, &context);
|
|
|
- for (q = strtok_r(str, " \n", &saveptr);
|
|
|
- q; q = strtok_r(NULL, " \n", &saveptr)) {
|
|
|
- if (q == strstr(q, text))
|
|
|
- lub_argv_add(matches, q);
|
|
|
+ if (str) {
|
|
|
+ for (q = strtok_r(str, " \n", &saveptr);
|
|
|
+ q; q = strtok_r(NULL, " \n", &saveptr)) {
|
|
|
+ if (q == strstr(q, text))
|
|
|
+ lub_argv_add(matches, q);
|
|
|
+ }
|
|
|
+ lub_string_free(str);
|
|
|
}
|
|
|
- lub_string_free(str);
|
|
|
}
|
|
|
|
|
|
if ((ptype = clish_param__get_ptype(param)))
|