]> git.sesse.net Git - xml-template/commitdiff
In C++0x, handle that attr->ns is NULL. Makes namespace test pass.
authorsgunderson@bigfoot.com <>
Wed, 21 Sep 2011 22:42:37 +0000 (00:42 +0200)
committersgunderson@bigfoot.com <>
Wed, 21 Sep 2011 22:42:37 +0000 (00:42 +0200)
c++0x/xml-template.cpp

index febece21a0b70a2b2bcfd923b350bba2fbedc9e1..fda97fc7ca97b83e28b8b4ab1f3d35558cd3011f 100644 (file)
@@ -115,7 +115,8 @@ void Substitute::process(xmlNode *node, bool clean)
                        string id;
                        xmlAttr *id_attr = NULL;
                        for (xmlAttr *attr = child->properties; attr != NULL; attr = attr->next) {
-                               if (strcmp(reinterpret_cast<const char *>(attr->ns->href), "http://template.sesse.net/") == 0 &&
+                               if (attr->ns != NULL &&
+                                   strcmp(reinterpret_cast<const char *>(attr->ns->href), "http://template.sesse.net/") == 0 &&
                                    strcmp(reinterpret_cast<const char *>(attr->name), "id") == 0) {
                                        xmlChar *id_buf = xmlNodeGetContent(attr->children);
                                        id = reinterpret_cast<const char *>(id_buf);