msxml3: Handle NULL child in appendChild().

This commit is contained in:
Nikolay Sivov 2014-04-03 10:04:34 +04:00 committed by Alexandre Julliard
parent c22cdeea29
commit db8ff72f00
2 changed files with 9 additions and 0 deletions

View File

@ -625,6 +625,9 @@ HRESULT node_append_child(xmlnode *This, IXMLDOMNode *child, IXMLDOMNode **outCh
VARIANT var;
HRESULT hr;
if (!child)
return E_INVALIDARG;
hr = IXMLDOMNode_get_nodeType(child, &type);
if(FAILED(hr) || type == NODE_ATTRIBUTE) {
if (outChild) *outChild = NULL;

View File

@ -8878,6 +8878,12 @@ static void test_appendChild(void)
EXPECT_NO_CHILDREN(doc);
EXPECT_NO_CHILDREN(doc2);
hr = IXMLDOMDocument_appendChild(doc2, NULL, NULL);
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
hr = IXMLDOMElement_appendChild(elem, NULL, NULL);
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
/* append from another document */
hr = IXMLDOMDocument_appendChild(doc2, (IXMLDOMNode*)elem, NULL);
ok(hr == S_OK, "got 0x%08x\n", hr);