Jacek Caban : mshtml: Properly return NULL parentElement.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Dec 8 11:07:36 CST 2015


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Tue Dec  8 15:14:05 2015 +0100

mshtml: Properly return NULL parentElement.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/mshtml/htmlelem.c  | 5 +++++
 dlls/mshtml/tests/dom.c | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c
index cd561b5..6c948d3 100644
--- a/dlls/mshtml/htmlelem.c
+++ b/dlls/mshtml/htmlelem.c
@@ -848,6 +848,11 @@ static HRESULT WINAPI HTMLElement_get_parentElement(IHTMLElement *iface, IHTMLEl
     if(FAILED(hres))
         return hres;
 
+    if(!node) {
+        *p = NULL;
+        return S_OK;
+    }
+
     hres = IHTMLDOMNode_QueryInterface(node, &IID_IHTMLElement, (void**)p);
     IHTMLDOMNode_Release(node);
     if(FAILED(hres))
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index b9f7935..b892ac0 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -5267,6 +5267,8 @@ static void test_insert_adjacent_elems(IHTMLDocument2 *doc, IHTMLElement *parent
     static const elem_type_t br_div_br[] = {ET_BR, ET_DIV, ET_BR};
 
     elem = test_create_elem(doc, "BR");
+    elem2 = test_elem_get_parent((IUnknown*)elem);
+    ok(!elem2, "get_parentElement returned %p\n", elem2);
     insert_adjacent_elem(parent, "BeforeEnd", elem);
     IHTMLElement_Release(elem);
 




More information about the wine-cvs mailing list