Commit db8ff72f authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

msxml3: Handle NULL child in appendChild().

parent c22cdeea
...@@ -625,6 +625,9 @@ HRESULT node_append_child(xmlnode *This, IXMLDOMNode *child, IXMLDOMNode **outCh ...@@ -625,6 +625,9 @@ HRESULT node_append_child(xmlnode *This, IXMLDOMNode *child, IXMLDOMNode **outCh
VARIANT var; VARIANT var;
HRESULT hr; HRESULT hr;
if (!child)
return E_INVALIDARG;
hr = IXMLDOMNode_get_nodeType(child, &type); hr = IXMLDOMNode_get_nodeType(child, &type);
if(FAILED(hr) || type == NODE_ATTRIBUTE) { if(FAILED(hr) || type == NODE_ATTRIBUTE) {
if (outChild) *outChild = NULL; if (outChild) *outChild = NULL;
......
...@@ -8878,6 +8878,12 @@ static void test_appendChild(void) ...@@ -8878,6 +8878,12 @@ static void test_appendChild(void)
EXPECT_NO_CHILDREN(doc); EXPECT_NO_CHILDREN(doc);
EXPECT_NO_CHILDREN(doc2); 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 */ /* append from another document */
hr = IXMLDOMDocument_appendChild(doc2, (IXMLDOMNode*)elem, NULL); hr = IXMLDOMDocument_appendChild(doc2, (IXMLDOMNode*)elem, NULL);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "got 0x%08x\n", hr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment