]> granicus.if.org Git - php/commitdiff
MFH: fix bug #47220 (segfault in dom_document_parser in recovery mode)
authorRob Richards <rrichards@php.net>
Mon, 26 Jan 2009 19:11:19 +0000 (19:11 +0000)
committerRob Richards <rrichards@php.net>
Mon, 26 Jan 2009 19:11:19 +0000 (19:11 +0000)
ext/dom/document.c

index b154232f33d997db81d8a8131339e68cb0cff2ff..1927852a11a7b5ff63b56d9740d248496d780bfe 100644 (file)
@@ -1687,7 +1687,7 @@ static xmlDocPtr dom_document_parser(zval *id, int mode, char *source, int optio
                        EG(error_reporting) = old_error_reporting;
                }
                /* If loading from memory, set the base reference uri for the document */
-               if (ret->URL == NULL && ctxt->directory != NULL) {
+               if (ret && ret->URL == NULL && ctxt->directory != NULL) {
                        ret->URL = xmlStrdup(ctxt->directory);
                }
        } else {