From 7db77df36d41d0150a9cc53ef122919c25fc17a7 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Mon, 6 Oct 2008 09:53:35 -0500 Subject: [PATCH] mshtml: Fixed handing non-element nodes in IHTMLElementCollection. --- dlls/mshtml/htmlelemcol.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/dlls/mshtml/htmlelemcol.c b/dlls/mshtml/htmlelemcol.c index cf112340e9d..f0ca6d76acd 100644 --- a/dlls/mshtml/htmlelemcol.c +++ b/dlls/mshtml/htmlelemcol.c @@ -359,6 +359,9 @@ static HRESULT HTMLElementCollection_get_dispid(IUnknown *iface, BSTR name, DWOR WCHAR *ptr; DWORD idx=0; + if(!*name) + return DISP_E_UNKNOWNNAME; + for(ptr = name; *ptr && isdigitW(*ptr); ptr++) idx = idx*10 + (*ptr-'0'); @@ -484,8 +487,9 @@ IHTMLElementCollection *create_collection_from_nodelist(HTMLDocument *doc, IUnkn nsIDOMNodeList_GetLength(nslist, &length); - buf.len = buf.size = length; - if(buf.len) { + buf.len = 0; + buf.size = length; + if(length) { nsIDOMNode *nsnode; buf.buf = heap_alloc(buf.size*sizeof(HTMLElement*)); @@ -493,9 +497,11 @@ IHTMLElementCollection *create_collection_from_nodelist(HTMLDocument *doc, IUnkn for(i=0; i