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

This commit is contained in:
Jacek Caban 2010-11-14 14:43:06 +01:00 committed by Alexandre Julliard
parent c481fb4bb8
commit 5caf8c3187
2 changed files with 11 additions and 0 deletions

View File

@ -565,6 +565,11 @@ static HRESULT WINAPI HTMLDocument_get_location(IHTMLDocument2 *iface, IHTMLLoca
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);
}

View File

@ -6974,6 +6974,7 @@ static void test_docfrag(IHTMLDocument2 *doc)
{
IHTMLElement *div, *body, *br;
IHTMLElementCollection *col;
IHTMLLocation *location;
IHTMLDocument2 *frag;
HRESULT hres;
@ -6995,6 +6996,11 @@ static void test_docfrag(IHTMLDocument2 *doc)
ok(hres == S_OK, "get_body failed: %08x\n", hres);
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");
test_node_append_child((IUnknown*)frag, (IUnknown*)br);
IHTMLElement_Release(br);