From b22a600e777643a5a7a4767a415442614a167e6d Mon Sep 17 00:00:00 2001 From: Martchus Date: Wed, 12 May 2021 17:52:36 +0200 Subject: [PATCH] Fix broken code in ArgumentParser::printBashCompletion() leading to crashes See https://github.com/Martchus/cpp-utilities/issues/19#issuecomment-839758443 --- application/argumentparser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/argumentparser.cpp b/application/argumentparser.cpp index 303a428..4fea820 100644 --- a/application/argumentparser.cpp +++ b/application/argumentparser.cpp @@ -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);