From 9f7d60ee27659912ea16e8e9a98c8fbbfc421b40 Mon Sep 17 00:00:00 2001 From: firewave Date: Fri, 19 Apr 2024 10:59:44 +0200 Subject: [PATCH] avoid duplicated `XMLElement::Attribute()` calls --- lib/importproject.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/importproject.cpp b/lib/importproject.cpp index 95cec874a87d..859574529de6 100644 --- a/lib/importproject.cpp +++ b/lib/importproject.cpp @@ -1158,8 +1158,9 @@ bool ImportProject::importCppcheckGuiProject(std::istream &istr, Settings *setti for (const tinyxml2::XMLElement *node = rootnode->FirstChildElement(); node; node = node->NextSiblingElement()) { const char* name = node->Name(); if (strcmp(name, CppcheckXml::RootPathName) == 0) { - if (node->Attribute(CppcheckXml::RootPathNameAttrib)) { - temp.basePaths.push_back(joinRelativePath(path, node->Attribute(CppcheckXml::RootPathNameAttrib))); + const char* attr = node->Attribute(CppcheckXml::RootPathNameAttrib); + if (attr) { + temp.basePaths.push_back(joinRelativePath(path, attr)); temp.relativePaths = true; } } else if (strcmp(name, CppcheckXml::BuildDirElementName) == 0)