Check node->name for null
authorMikael Magnusson <mikachu@gmail.com>
Fri, 12 Feb 2010 04:05:40 +0000 (05:05 +0100)
committerMikael Magnusson <mikachu@gmail.com>
Fri, 12 Feb 2010 04:07:44 +0000 (05:07 +0100)
Seems to happen sometimes with a well placed xml comment.

obt/xml.c

index 92e2343..da3e866 100644 (file)
--- a/obt/xml.c
+++ b/obt/xml.c
@@ -300,8 +300,10 @@ void obt_xml_tree(ObtXmlInst *i, xmlNodePtr node)
     g_assert(i->doc); /* a doc is open? */
 
     while (node) {
-        struct Callback *c = g_hash_table_lookup(i->callbacks, node->name);
-        if (c) c->func(node, c->data);
+        if (node->name) {
+            struct Callback *c = g_hash_table_lookup(i->callbacks, node->name);
+            if (c) c->func(node, c->data);
+        }
         node = node->next;
     }
 }