summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorDavid Sommerseth <dazo@users.sourceforge.net>2009-03-22 19:42:24 +0100
committerDavid Sommerseth <dazo@users.sourceforge.net>2009-03-22 19:42:24 +0100
commit51778987ec3cc565fa4eaaacdc28f98c02a23226 (patch)
tree39e6e57026c0cbd7faba325e554e9446eb097ba2 /common
parent20f4b70c6f47b4a48197e05691de67225512f36f (diff)
downloadeurephia-51778987ec3cc565fa4eaaacdc28f98c02a23226.tar.gz
eurephia-51778987ec3cc565fa4eaaacdc28f98c02a23226.tar.xz
eurephia-51778987ec3cc565fa4eaaacdc28f98c02a23226.zip
Avoid segfault if xmlDoc or XML root element is NULL in eurephiaXML_getRoot(...)
Diffstat (limited to 'common')
-rw-r--r--common/eurephia_xml.c3
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;
}