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

index 686506ffd35b370bfbac13b34485d2effc8a6ec9..df5e1d400dc931dd065d869e2fb584be0b8ffddb 100644 (file)
@@ -1627,7 +1627,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 {