Fix issue detected by Coverity, XMLElement::Attribute might return null

This commit is contained in:
Daniel Marjamäki 2017-08-02 07:56:22 +02:00
parent e6f6efc684
commit 05cdda3f4c
1 changed files with 5 additions and 2 deletions

View File

@ -454,8 +454,11 @@ void ImportProject::importVcxproj(const std::string &filename, std::map<std::str
} }
} else { } else {
for (const tinyxml2::XMLElement *e = node->FirstChildElement(); e; e = e->NextSiblingElement()) { for (const tinyxml2::XMLElement *e = node->FirstChildElement(); e; e = e->NextSiblingElement()) {
if (std::strcmp(e->Name(), "ClCompile") == 0) if (std::strcmp(e->Name(), "ClCompile") != 0) {
compileList.push_back(e->Attribute("Include")); const char *include = e->Attribute("Include");
if (include)
compileList.push_back(include);
}
} }
} }
} else if (std::strcmp(node->Name(), "ItemDefinitionGroup") == 0) { } else if (std::strcmp(node->Name(), "ItemDefinitionGroup") == 0) {