From c529de6e074328fac4b3dd8a17e6e80639edbf79 Mon Sep 17 00:00:00 2001 From: Martin Ettl Date: Tue, 29 Oct 2013 00:36:27 +0100 Subject: [PATCH] Library: tinyxml2::FirstChildElement() is capable of returning 0. This fixes a waring of scan.coverity(): CID 1113430 (#1 of 1): Dereference null return value (NULL_RETURNS) --- lib/library.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/library.cpp b/lib/library.cpp index 4edf10a92..c20ddfffb 100644 --- a/lib/library.cpp +++ b/lib/library.cpp @@ -67,7 +67,7 @@ bool Library::load(const char exename[], const char path[]) bool Library::load(const tinyxml2::XMLDocument &doc) { const tinyxml2::XMLElement * const rootnode = doc.FirstChildElement(); - if (strcmp(rootnode->Name(),"def") != 0) + if (rootnode && strcmp(rootnode->Name(),"def") != 0) return false; for (const tinyxml2::XMLElement *node = rootnode->FirstChildElement(); node; node = node->NextSiblingElement()) {