diff --git a/lib/preprocessor.cpp b/lib/preprocessor.cpp index a5e97b205..1543fa939 100644 --- a/lib/preprocessor.cpp +++ b/lib/preprocessor.cpp @@ -819,8 +819,11 @@ std::string Preprocessor::removeParentheses(const std::string &str) --ind; if (ind == 0) { if (i == line.length() - 1) { - line[line.find('(')] = ' '; - line.erase(line.length() - 1); + const std::string::size_type posIndx = line.find('('); + if (posIndx != std::string::npos) { + line[posIndx] = ' '; + line.erase(line.length() - 1); + } } break; }