Commit 10a832cc authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Properly handle NULL value in set_nsstyle_attr.

parent 36a47dd0
...@@ -351,16 +351,18 @@ static LPWSTR fix_url_value(LPCWSTR val) ...@@ -351,16 +351,18 @@ static LPWSTR fix_url_value(LPCWSTR val)
return ret; return ret;
} }
HRESULT set_nsstyle_attr(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, LPCWSTR value, DWORD flags) HRESULT set_nsstyle_attr(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, const WCHAR *value, DWORD flags)
{ {
nsAString str_name, str_value, str_empty; nsAString str_name, str_value, str_empty;
LPWSTR val = NULL; LPWSTR val = NULL;
nsresult nsres; nsresult nsres;
if(value) {
if(flags & ATTR_FIX_PX) if(flags & ATTR_FIX_PX)
val = fix_px_value(value); val = fix_px_value(value);
if(flags & ATTR_FIX_URL) if(flags & ATTR_FIX_URL)
val = fix_url_value(value); val = fix_url_value(value);
}
nsAString_InitDepend(&str_name, style_tbl[sid].name); nsAString_InitDepend(&str_name, style_tbl[sid].name);
nsAString_InitDepend(&str_value, val ? val : value); nsAString_InitDepend(&str_value, val ? val : value);
......
...@@ -1052,6 +1052,19 @@ static void test_body_style(IHTMLStyle *style) ...@@ -1052,6 +1052,19 @@ static void test_body_style(IHTMLStyle *style)
ok(!strcmp_wa(V_BSTR(&v), "70px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v))); ok(!strcmp_wa(V_BSTR(&v), "70px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
VariantClear(&v); VariantClear(&v);
V_VT(&v) = VT_BSTR;
V_BSTR(&v) = NULL;
hres = IHTMLStyle_put_height(style, v);
ok(hres == S_OK, "put_height failed: %08x\n", hres);
VariantClear(&v);
V_VT(&v) = VT_EMPTY;
hres = IHTMLStyle_get_height(style, &v);
ok(hres == S_OK, "get_height failed: %08x\n", hres);
ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
ok(!V_BSTR(&v), "V_BSTR(v) = %s, expected NULL\n", wine_dbgstr_w(V_BSTR(&v)));
VariantClear(&v);
V_VT(&v) = VT_I4; V_VT(&v) = VT_I4;
V_I4(&v) = 64; V_I4(&v) = 64;
hres = IHTMLStyle_put_height(style, v); hres = IHTMLStyle_put_height(style, v);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment