Commit 5caf8c31 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Correctly handle NULL nsdoc in IHTMLDocument2::get_location.

parent c481fb4b
...@@ -565,6 +565,11 @@ static HRESULT WINAPI HTMLDocument_get_location(IHTMLDocument2 *iface, IHTMLLoca ...@@ -565,6 +565,11 @@ static HRESULT WINAPI HTMLDocument_get_location(IHTMLDocument2 *iface, IHTMLLoca
TRACE("(%p)->(%p)\n", This, p); TRACE("(%p)->(%p)\n", This, p);
if(!This->doc_node->nsdoc) {
WARN("NULL nsdoc\n");
return E_UNEXPECTED;
}
return IHTMLWindow2_get_location(HTMLWINDOW2(This->window), p); return IHTMLWindow2_get_location(HTMLWINDOW2(This->window), p);
} }
......
...@@ -6974,6 +6974,7 @@ static void test_docfrag(IHTMLDocument2 *doc) ...@@ -6974,6 +6974,7 @@ static void test_docfrag(IHTMLDocument2 *doc)
{ {
IHTMLElement *div, *body, *br; IHTMLElement *div, *body, *br;
IHTMLElementCollection *col; IHTMLElementCollection *col;
IHTMLLocation *location;
IHTMLDocument2 *frag; IHTMLDocument2 *frag;
HRESULT hres; HRESULT hres;
...@@ -6995,6 +6996,11 @@ static void test_docfrag(IHTMLDocument2 *doc) ...@@ -6995,6 +6996,11 @@ static void test_docfrag(IHTMLDocument2 *doc)
ok(hres == S_OK, "get_body failed: %08x\n", hres); ok(hres == S_OK, "get_body failed: %08x\n", hres);
ok(!body, "body != NULL\n"); ok(!body, "body != NULL\n");
location = (void*)0xdeadbeef;
hres = IHTMLDocument2_get_location(frag, &location);
ok(hres == E_UNEXPECTED, "get_location failed: %08x\n", hres);
ok(location == (void*)0xdeadbeef, "location changed\n");
br = test_create_elem(doc, "BR"); br = test_create_elem(doc, "BR");
test_node_append_child((IUnknown*)frag, (IUnknown*)br); test_node_append_child((IUnknown*)frag, (IUnknown*)br);
IHTMLElement_Release(br); IHTMLElement_Release(br);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment