avoid segfault on the last word of the command history
This commit is contained in:
@ -229,7 +229,8 @@ static char *cmd_generator(const char *text, int state)
|
|||||||
len = strlen(text);
|
len = strlen(text);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if ((len == 0) || (commands[idx].substr(0, len) == text))
|
if ((idx < commands.size())
|
||||||
|
&& ((len == 0) || (commands[idx].substr(0, len) == text)))
|
||||||
return dupstring(commands[idx++]);
|
return dupstring(commands[idx++]);
|
||||||
else
|
else
|
||||||
++idx;
|
++idx;
|
||||||
|
|||||||
Reference in New Issue
Block a user