Library: return false from load() when tinyxml::FirstChildElement() return a NULL pointer.

This commit is contained in:
Martin Ettl 2013-10-31 19:49:36 +01:00
parent 63d9fd4210
commit 5156481db4
1 changed files with 5 additions and 1 deletions

View File

@ -67,7 +67,11 @@ bool Library::load(const char exename[], const char path[])
bool Library::load(const tinyxml2::XMLDocument &doc)
{
const tinyxml2::XMLElement * const rootnode = doc.FirstChildElement();
if (rootnode && strcmp(rootnode->Name(),"def") != 0)
if (rootnode == NULL)
return false;
if (strcmp(rootnode->Name(),"def") != 0)
return false;
for (const tinyxml2::XMLElement *node = rootnode->FirstChildElement(); node; node = node->NextSiblingElement()) {