diff options
author | David Sommerseth <dazo@users.sourceforge.net> | 2009-03-22 19:42:24 +0100 |
---|---|---|
committer | David Sommerseth <dazo@users.sourceforge.net> | 2009-03-22 19:42:24 +0100 |
commit | 51778987ec3cc565fa4eaaacdc28f98c02a23226 (patch) | |
tree | 39e6e57026c0cbd7faba325e554e9446eb097ba2 | |
parent | 20f4b70c6f47b4a48197e05691de67225512f36f (diff) | |
download | eurephia-51778987ec3cc565fa4eaaacdc28f98c02a23226.tar.gz eurephia-51778987ec3cc565fa4eaaacdc28f98c02a23226.tar.xz eurephia-51778987ec3cc565fa4eaaacdc28f98c02a23226.zip |
Avoid segfault if xmlDoc or XML root element is NULL in eurephiaXML_getRoot(...)
-rw-r--r-- | common/eurephia_xml.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/common/eurephia_xml.c b/common/eurephia_xml.c index e2a1de5..8167916 100644 --- a/common/eurephia_xml.c +++ b/common/eurephia_xml.c @@ -83,10 +83,9 @@ xmlNode *eurephiaXML_getRoot(eurephiaCTX *ctx, xmlDoc *doc, const char *nodeset, int xmlformat = 0; root = xmlDocGetRootElement(doc); - if( xmlStrcmp(root->name, (xmlChar *)"eurephia") != 0 ) { + if( (root == NULL) || (xmlStrcmp(root->name, (xmlChar *)"eurephia") != 0) ) { eurephia_log(ctx, LOG_FATAL, 0, "Could not find eurephia XML root element. " "Not a valid eurephia XML document."); - printf("-%s-\n", root->name); return NULL; } |