From 5156481db431cbb15bb2d8b7b57ed02eca6500cc Mon Sep 17 00:00:00 2001 From: Martin Ettl Date: Thu, 31 Oct 2013 19:49:36 +0100 Subject: [PATCH] Library: return false from load() when tinyxml::FirstChildElement() return a NULL pointer. --- lib/library.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/library.cpp b/lib/library.cpp index 8e9468101..a69d1fcae 100644 --- a/lib/library.cpp +++ b/lib/library.cpp @@ -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()) {