From: Rob Richards Date: Tue, 31 Jul 2007 15:07:54 +0000 (+0000) Subject: MFH: fix possible crash X-Git-Tag: php-5.2.4RC1~26 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ce582024a51050c3f39748a7eaf44d41ab2f5cdc;p=php MFH: fix possible crash --- diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c index d480497738..47260f965f 100644 --- a/ext/simplexml/simplexml.c +++ b/ext/simplexml/simplexml.c @@ -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); }