]> granicus.if.org Git - php/commitdiff
MFH: fix possible crash
authorRob Richards <rrichards@php.net>
Tue, 31 Jul 2007 15:07:54 +0000 (15:07 +0000)
committerRob Richards <rrichards@php.net>
Tue, 31 Jul 2007 15:07:54 +0000 (15:07 +0000)
ext/simplexml/simplexml.c

index d480497738d03773f4773171fbccc1f560e75b4b..47260f965f6517ab083914a71898a397047a837b 100644 (file)
@@ -1575,7 +1575,9 @@ SXE_METHOD(addChild)
                        newnode->ns = NULL;
                        nsptr = xmlNewNs(newnode, (xmlChar *)nsuri, prefix);
                } else {
-                       nsptr = xmlSearchNsByHref(node->doc, node, (xmlChar *)nsuri);
+                       if (node) {
+                               nsptr = xmlSearchNsByHref(node->doc, node, (xmlChar *)nsuri);
+                       }
                        if (nsptr == NULL) {
                                nsptr = xmlNewNs(newnode, (xmlChar *)nsuri, prefix);
                        }