diff --git a/Libraries/LibHTML/Parser/HTMLParser.cpp b/Libraries/LibHTML/Parser/HTMLParser.cpp index bf1accfb75..c8275cd33c 100644 --- a/Libraries/LibHTML/Parser/HTMLParser.cpp +++ b/Libraries/LibHTML/Parser/HTMLParser.cpp @@ -318,13 +318,13 @@ RefPtr parse_html_fragment(Document& document, const StringVie return fragment; } -NonnullRefPtr parse_html_document(const StringView& html, const URL& url) +RefPtr parse_html_document(const StringView& html, const URL& url) { auto document = adopt(*new Document); document->set_url(url); - bool success = parse_html_document(html, *document, *document); - ASSERT(success); + if (!parse_html_document(html, *document, *document)) + return nullptr; document->fixup(); diff --git a/Libraries/LibHTML/Parser/HTMLParser.h b/Libraries/LibHTML/Parser/HTMLParser.h index 46dc22428a..8b06ce2842 100644 --- a/Libraries/LibHTML/Parser/HTMLParser.h +++ b/Libraries/LibHTML/Parser/HTMLParser.h @@ -5,5 +5,5 @@ class DocumentFragment; -NonnullRefPtr parse_html_document(const StringView&, const URL& = URL()); +RefPtr parse_html_document(const StringView&, const URL& = URL()); RefPtr parse_html_fragment(Document&, const StringView&);