diff --git a/dlls/msxml3/node.c b/dlls/msxml3/node.c index bdc9ac95e56..a33777fa591 100644 --- a/dlls/msxml3/node.c +++ b/dlls/msxml3/node.c @@ -625,7 +625,8 @@ static HRESULT WINAPI xmlnode_removeChild( TRACE("%p->(%p, %p)\n", This, childNode, oldChild); - *oldChild = NULL; + if(oldChild) + *oldChild = NULL; if(!childNode) return E_INVALIDARG; @@ -651,7 +652,9 @@ static HRESULT WINAPI xmlnode_removeChild( IXMLDOMNode_Release(child); IXMLDOMNode_AddRef(childNode); - *oldChild = childNode; + + if(oldChild) + *oldChild = childNode; return S_OK; } diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c index 3745fca08e7..19a9a2ff0f0 100644 --- a/dlls/msxml3/tests/domdoc.c +++ b/dlls/msxml3/tests/domdoc.c @@ -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 );