diff --git a/common/complete.c b/common/complete.c index 586a7eb..f9c05b4 100644 --- a/common/complete.c +++ b/common/complete.c @@ -88,6 +88,9 @@ int device_complete(struct string_list *sl, char *instr) char cmd[128]; int len, len2; + if (!instr) + instr = ""; + len = strlen(instr); for_each_device(dev) { @@ -112,6 +115,9 @@ static int device_param_complete(char begin, struct device_d *dev, char *tmp = cmd; int len, len2; + if (!instr) + instr = ""; + len = strlen(instr); if (begin) { tmp[0] = begin; @@ -156,6 +162,9 @@ static int env_param_complete(struct string_list *sl, char *instr, int eval) int len, len2; char end = '='; + if (!instr) + instr = ""; + if (eval) { cmd[0] = '$'; tmp++;