Fix broken code in ArgumentParser::printBashCompletion() leading to crashes

See https://github.com/Martchus/cpp-utilities/issues/19#issuecomment-839758443
This commit is contained in:
Martchus 2021-05-12 17:52:36 +02:00
parent f549285fde
commit b22a600e77
1 changed files with 1 additions and 1 deletions

View File

@ -1511,7 +1511,7 @@ void ArgumentParser::printBashCompletion(int argc, const char *const *argv, unsi
if (file[0] == '\"' || file[0] == '\'') {
file.erase(0, 1);
}
if (file.size() > 1 && (file[dir.size() - 2] == '\"' || dir[file.size() - 2] == '\'')) {
if (file.size() > 1 && (file[file.size() - 2] == '\"' || file[file.size() - 2] == '\'')) {
file.erase(file.size() - 2, 1);
}
actualFile = move(file);