From 0bbc95e4f6f5776a6dfccc80878406cffc78de0f Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Thu, 4 Aug 2011 14:05:23 +0200 Subject: [PATCH] mshtml: Fix DOCUMENT_NODE handling in nsnode_to_nsstring_rec. --- dlls/mshtml/nsembed.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/dlls/mshtml/nsembed.c b/dlls/mshtml/nsembed.c index 33d34b9a4f6..2bebf8b281f 100644 --- a/dlls/mshtml/nsembed.c +++ b/dlls/mshtml/nsembed.c @@ -794,10 +794,12 @@ static HRESULT nsnode_to_nsstring_rec(nsIContentSerializer *serializer, nsIDOMNo return E_FAIL; } - nsres = nsIDOMNode_QueryInterface(nsnode, &IID_nsIContent, (void**)&nscontent); - if(NS_FAILED(nsres)) { - ERR("Could not get nsIDontent interface: %08x\n", nsres); - return E_FAIL; + if(type != DOCUMENT_NODE) { + nsres = nsIDOMNode_QueryInterface(nsnode, &IID_nsIContent, (void**)&nscontent); + if(NS_FAILED(nsres)) { + ERR("Could not get nsIContent interface: %08x\n", nsres); + return E_FAIL; + } } switch(type) { @@ -849,7 +851,8 @@ static HRESULT nsnode_to_nsstring_rec(nsIContentSerializer *serializer, nsIDOMNo if(type == ELEMENT_NODE) nsIContentSerializer_AppendElementEnd(serializer, nscontent, str); - nsIContent_Release(nscontent); + if(type != DOCUMENT_NODE) + nsIContent_Release(nscontent); return S_OK; }