mshtml: Fixed handling NULL argument in IHTMLElement::contains implementation.

This commit is contained in:
Jacek Caban 2014-08-18 17:32:27 +02:00 committed by Alexandre Julliard
parent d5d728706b
commit 7c7a594692
2 changed files with 13 additions and 12 deletions

View File

@ -882,12 +882,14 @@ static HRESULT WINAPI HTMLElement_contains(IHTMLElement *iface, IHTMLElement *pC
VARIANT_BOOL *pfResult) VARIANT_BOOL *pfResult)
{ {
HTMLElement *This = impl_from_IHTMLElement(iface); HTMLElement *This = impl_from_IHTMLElement(iface);
HTMLElement *child; cpp_bool result = FALSE;
cpp_bool result;
nsresult nsres;
TRACE("(%p)->(%p %p)\n", This, pChild, pfResult); TRACE("(%p)->(%p %p)\n", This, pChild, pfResult);
if(pChild) {
HTMLElement *child;
nsresult nsres;
child = unsafe_impl_from_IHTMLElement(pChild); child = unsafe_impl_from_IHTMLElement(pChild);
if(!child) { if(!child) {
ERR("not our element\n"); ERR("not our element\n");
@ -895,9 +897,7 @@ static HRESULT WINAPI HTMLElement_contains(IHTMLElement *iface, IHTMLElement *pC
} }
nsres = nsIDOMNode_Contains(This->node.nsnode, child->node.nsnode, &result); nsres = nsIDOMNode_Contains(This->node.nsnode, child->node.nsnode, &result);
if(NS_FAILED(nsres)) { assert(nsres == NS_OK);
ERR("failed\n");
return E_FAIL;
} }
*pfResult = result ? VARIANT_TRUE : VARIANT_FALSE; *pfResult = result ? VARIANT_TRUE : VARIANT_FALSE;

View File

@ -6913,6 +6913,7 @@ static void test_elems(IHTMLDocument2 *doc)
test_elem_contains(elem, elem3, VARIANT_FALSE); test_elem_contains(elem, elem3, VARIANT_FALSE);
test_elem_contains(elem, elem2, VARIANT_FALSE); test_elem_contains(elem, elem2, VARIANT_FALSE);
test_elem_contains(elem, elem, VARIANT_TRUE); test_elem_contains(elem, elem, VARIANT_TRUE);
test_elem_contains(elem, NULL, VARIANT_FALSE);
IHTMLElement_Release(elem2); IHTMLElement_Release(elem2);
elem2 = test_elem_get_parent((IUnknown*)elem3); elem2 = test_elem_get_parent((IUnknown*)elem3);