msxml3: oldChild in xmlnode_removeChild may be NULL.

This commit is contained in:
Piotr Caban 2008-07-10 15:22:21 +02:00 committed by Alexandre Julliard
parent 088f3eef9c
commit 93e76ece37
2 changed files with 17 additions and 2 deletions

View File

@ -625,6 +625,7 @@ static HRESULT WINAPI xmlnode_removeChild(
TRACE("%p->(%p, %p)\n", This, childNode, oldChild);
if(oldChild)
*oldChild = NULL;
if(!childNode) return E_INVALIDARG;
@ -651,6 +652,8 @@ static HRESULT WINAPI xmlnode_removeChild(
IXMLDOMNode_Release(child);
IXMLDOMNode_AddRef(childNode);
if(oldChild)
*oldChild = childNode;
return S_OK;
}

View File

@ -1768,6 +1768,18 @@ static void test_removeChild(void)
ok( node3 == NULL, "%p\n", node3 );
IXMLDOMNode_Release( node2 );
IXMLDOMNode_Release( node4 );
r = IXMLDOMNodeList_get_item( node_list, 0, &node4 );
ok( r == S_OK, "ret %08x\n", r);
r = IXMLDOMElement_removeChild( element, node4, NULL );
ok( r == S_OK, "ret %08x\n", r);
r = IXMLDOMNode_get_parentNode( node4, &node3 );
ok( r == S_FALSE, "ret %08x\n", r);
ok( node3 == NULL, "%p\n", node3 );
IXMLDOMNode_Release( node4 );
IXMLDOMNodeList_Release( node_list2 );
IXMLDOMNode_Release( node );