Jacek Caban : mshtml: Correctly handle NULL nsdoc in IHTMLDocument2:: get_location.

Alexandre Julliard julliard at winehq.org
Mon Nov 15 13:28:48 CST 2010


Module: wine
Branch: master
Commit: 5caf8c3187c1769bf5381a8093c4f92538e25dfc
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=5caf8c3187c1769bf5381a8093c4f92538e25dfc

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Sun Nov 14 14:43:06 2010 +0100

mshtml: Correctly handle NULL nsdoc in IHTMLDocument2::get_location.

---

 dlls/mshtml/htmldoc.c   |    5 +++++
 dlls/mshtml/tests/dom.c |    6 ++++++
 2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c
index 50a9f67..28059cc 100644
--- a/dlls/mshtml/htmldoc.c
+++ b/dlls/mshtml/htmldoc.c
@@ -565,6 +565,11 @@ static HRESULT WINAPI HTMLDocument_get_location(IHTMLDocument2 *iface, IHTMLLoca
 
     TRACE("(%p)->(%p)\n", This, p);
 
+    if(!This->doc_node->nsdoc) {
+        WARN("NULL nsdoc\n");
+        return E_UNEXPECTED;
+    }
+
     return IHTMLWindow2_get_location(HTMLWINDOW2(This->window), p);
 }
 
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index ea010c9..8cf678a 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -6974,6 +6974,7 @@ static void test_docfrag(IHTMLDocument2 *doc)
 {
     IHTMLElement *div, *body, *br;
     IHTMLElementCollection *col;
+    IHTMLLocation *location;
     IHTMLDocument2 *frag;
     HRESULT hres;
 
@@ -6995,6 +6996,11 @@ static void test_docfrag(IHTMLDocument2 *doc)
     ok(hres == S_OK, "get_body failed: %08x\n", hres);
     ok(!body, "body != NULL\n");
 
+    location = (void*)0xdeadbeef;
+    hres = IHTMLDocument2_get_location(frag, &location);
+    ok(hres == E_UNEXPECTED, "get_location failed: %08x\n", hres);
+    ok(location == (void*)0xdeadbeef, "location changed\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