From ce582024a51050c3f39748a7eaf44d41ab2f5cdc Mon Sep 17 00:00:00 2001 From: Rob Richards Date: Tue, 31 Jul 2007 15:07:54 +0000 Subject: [PATCH] MFH: fix possible crash --- ext/simplexml/simplexml.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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); } -- 2.40.0