Fix behavior on empty completion request
This commit is contained in:
parent
f86a8b3700
commit
71231c29da
|
@ -665,9 +665,11 @@ void ArgumentParser::readArgs(int argc, const char * const *argv)
|
|||
// the first argument after "--bash-completion-for" is the index of the current word
|
||||
try {
|
||||
currentWordIndex = (--argc ? stringToNumber<unsigned int, string>(*(++argv)) : 0);
|
||||
++argv, --argc;
|
||||
} catch(const ConversionException &) {
|
||||
currentWordIndex = static_cast<unsigned int>(argc - 1);
|
||||
currentWordIndex = static_cast<unsigned int>(argc);
|
||||
}
|
||||
if(argc) {
|
||||
++argv, --argc;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue