From 3e6681e2b37eadccb92cab1800f108323d39ef0d Mon Sep 17 00:00:00 2001 From: yyny <6576327+yyny@users.noreply.github.com> Date: Mon, 5 Jul 2021 08:08:15 +0200 Subject: [PATCH] Fix assertion failure in errorlogger.cpp (#3318) --- lib/cppcheck.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/cppcheck.cpp b/lib/cppcheck.cpp index fd7e26856..824c9cfa1 100644 --- a/lib/cppcheck.cpp +++ b/lib/cppcheck.cpp @@ -272,8 +272,10 @@ static std::string executeAddon(const AddonInfo &addonInfo, std::istringstream istr(result); std::string line; while (std::getline(istr, line)) { - if (line.compare(0,9,"Checking ", 0, 9) != 0 && !line.empty() && line[0] != '{') + if (line.compare(0,9,"Checking ", 0, 9) != 0 && !line.empty() && line[0] != '{') { + result.erase(result.find_last_not_of('\n') + 1, std::string::npos); // Remove trailing newlines throw InternalError(nullptr, "Failed to execute '" + pythonExe + " " + args + "'. " + result); + } } // Valid results