From: Gabriel Ivăncescu <gabrielopcode(a)gmail.com> Signed-off-by: Gabriel Ivăncescu <gabrielopcode(a)gmail.com> --- dlls/mshtml/htmlnode.c | 4 ++++ dlls/mshtml/tests/dom.c | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/dlls/mshtml/htmlnode.c b/dlls/mshtml/htmlnode.c index 032c6771729..f06c7609288 100644 --- a/dlls/mshtml/htmlnode.c +++ b/dlls/mshtml/htmlnode.c @@ -651,6 +651,10 @@ static HRESULT WINAPI HTMLDOMNode_replaceChild(IHTMLDOMNode *iface, IHTMLDOMNode TRACE("(%p)->(%p %p %p)\n", This, newChild, oldChild, node); + *node = NULL; + if(!newChild || !oldChild) + return E_INVALIDARG; + node_new = get_node_obj(newChild); if(!node_new) return E_FAIL; diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index ea592ad5996..b58278b6169 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -11237,6 +11237,16 @@ static void test_replacechild_elems(IHTMLDocument2 *doc) nodeBody = _get_node_iface(__LINE__, (IUnknown *)body); + nodeNew = (void*)0xdeadbeef; + hres = IHTMLDOMNode_replaceChild(nodeBody, node3, NULL, &nodeNew); + ok(hres == E_INVALIDARG, "Expected E_INVALIDARG, got 0x%08lx\n", hres); + ok(nodeNew == NULL, "nodeNew != NULL\n"); + + nodeNew = (void*)0xdeadbeef; + hres = IHTMLDOMNode_replaceChild(nodeBody, NULL, node2, &nodeNew); + ok(hres == E_INVALIDARG, "Expected E_INVALIDARG, got 0x%08lx\n", hres); + ok(nodeNew == NULL, "nodeNew != NULL\n"); + hres = IHTMLDOMNode_replaceChild(nodeBody, node3, node2, &nodeNew); ok(hres == S_OK, "Expected S_OK, got 0x%08lx\n", hres); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/8637