diff --git a/lib/cppcheck.cpp b/lib/cppcheck.cpp index 12a9ef7f5..b12ce70fb 100644 --- a/lib/cppcheck.cpp +++ b/lib/cppcheck.cpp @@ -1398,6 +1398,8 @@ void CppCheck::analyseClangTidy(const ImportProject::FileSettings &fileSettings const std::size_t endNamePos = line.rfind(":", endLinePos - 1); const std::size_t endMsgTypePos = line.find(':', endColumnPos + 2); const std::size_t endErrorPos = line.rfind('[', std::string::npos); + if(endLinePos==std::string::npos || endNamePos==std::string::npos || endMsgTypePos==std::string::npos || endErrorPos==std::string::npos) + continue; const std::string lineNumString = line.substr(endNamePos + 1, endLinePos - endNamePos - 1); const std::string columnNumString = line.substr(endLinePos + 1, endColumnPos - endLinePos - 1);