Jacek Caban : mshtml: Correctly handle NULL nsdoc in IHTMLDocument2:: get_body.
Alexandre Julliard
julliard at winehq.org
Mon Nov 15 13:28:48 CST 2010
Module: wine
Branch: master
Commit: c481fb4bb8a8b71265d83b6a4b25454fac50aab5
URL: http://source.winehq.org/git/wine.git/?a=commit;h=c481fb4bb8a8b71265d83b6a4b25454fac50aab5
Author: Jacek Caban <jacek at codeweavers.com>
Date: Sun Nov 14 14:42:55 2010 +0100
mshtml: Correctly handle NULL nsdoc in IHTMLDocument2::get_body.
---
dlls/mshtml/htmldoc.c | 16 +++++++---------
dlls/mshtml/tests/dom.c | 7 ++++++-
2 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c
index 9299170..50a9f67 100644
--- a/dlls/mshtml/htmldoc.c
+++ b/dlls/mshtml/htmldoc.c
@@ -140,19 +140,17 @@ static HRESULT WINAPI HTMLDocument_get_body(IHTMLDocument2 *iface, IHTMLElement
HTMLDocument *This = HTMLDOC_THIS(iface);
nsIDOMHTMLElement *nsbody = NULL;
HTMLDOMNode *node;
- nsresult nsres;
TRACE("(%p)->(%p)\n", This, p);
- if(!This->doc_node->nsdoc) {
- WARN("NULL nsdoc\n");
- return E_UNEXPECTED;
- }
+ if(This->doc_node->nsdoc) {
+ nsresult nsres;
- nsres = nsIDOMHTMLDocument_GetBody(This->doc_node->nsdoc, &nsbody);
- if(NS_FAILED(nsres)) {
- TRACE("Could not get body: %08x\n", nsres);
- return E_UNEXPECTED;
+ nsres = nsIDOMHTMLDocument_GetBody(This->doc_node->nsdoc, &nsbody);
+ if(NS_FAILED(nsres)) {
+ TRACE("Could not get body: %08x\n", nsres);
+ return E_UNEXPECTED;
+ }
}
if(nsbody) {
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index d075e59..ea010c9 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -6972,7 +6972,7 @@ static IHTMLDocument2 *create_docfrag(IHTMLDocument2 *doc)
static void test_docfrag(IHTMLDocument2 *doc)
{
- IHTMLElement *div, *br;
+ IHTMLElement *div, *body, *br;
IHTMLElementCollection *col;
IHTMLDocument2 *frag;
HRESULT hres;
@@ -6990,6 +6990,11 @@ static void test_docfrag(IHTMLDocument2 *doc)
test_disp((IUnknown*)frag, &DIID_DispHTMLDocument, "[object]");
+ body = (void*)0xdeadbeef;
+ hres = IHTMLDocument2_get_body(frag, &body);
+ ok(hres == S_OK, "get_body failed: %08x\n", hres);
+ ok(!body, "body != NULL\n");
+
br = test_create_elem(doc, "BR");
test_node_append_child((IUnknown*)frag, (IUnknown*)br);
IHTMLElement_Release(br);
More information about the wine-cvs
mailing list