Commit 571b7a5a authored by André Hentschel's avatar André Hentschel Committed by Alexandre Julliard

oleaut32: Fix a crash in VB6.

parent edf050cf
...@@ -463,6 +463,9 @@ static HRESULT WINAPI OLEFontImpl_put_Name( ...@@ -463,6 +463,9 @@ static HRESULT WINAPI OLEFontImpl_put_Name(
OLEFontImpl *this = (OLEFontImpl *)iface; OLEFontImpl *this = (OLEFontImpl *)iface;
TRACE("(%p)->(%p)\n", this, name); TRACE("(%p)->(%p)\n", this, name);
if (!name)
return CTL_E_INVALIDPROPERTYVALUE;
if (this->description.lpstrName==0) if (this->description.lpstrName==0)
{ {
this->description.lpstrName = HeapAlloc(GetProcessHeap(), this->description.lpstrName = HeapAlloc(GetProcessHeap(),
......
...@@ -795,6 +795,45 @@ static void test_AddRefHfont(void) ...@@ -795,6 +795,45 @@ static void test_AddRefHfont(void)
IFont_Release(ifnt3); IFont_Release(ifnt3);
} }
static void test_returns(void)
{
IFont *pFont;
FONTDESC fontdesc;
HRESULT hr;
fontdesc.cbSizeofstruct = sizeof(fontdesc);
fontdesc.lpstrName = MSSansSerif_font;
fontdesc.cySize.int64 = 12 * 10000; /* 12 pt */
fontdesc.sWeight = FW_NORMAL;
fontdesc.sCharset = 0;
fontdesc.fItalic = FALSE;
fontdesc.fUnderline = FALSE;
fontdesc.fStrikethrough = FALSE;
hr = pOleCreateFontIndirect(&fontdesc, &IID_IFont, (void **)&pFont);
ok_ole_success(hr, "OleCreateFontIndirect");
hr = IFont_put_Name(pFont, NULL);
ok(hr == CTL_E_INVALIDPROPERTYVALUE,
"IFont::put_Name: Expected CTL_E_INVALIDPROPERTYVALUE got 0x%08x\n",
hr);
hr = IFont_get_Name(pFont, NULL);
ok(hr == E_POINTER,
"IFont::get_Name: Expected E_POINTER got 0x%08x\n",
hr);
hr = IFont_get_Size(pFont, NULL);
ok(hr == E_POINTER,
"IFont::get_Size: Expected E_POINTER got 0x%08x\n",
hr);
hr = IFont_get_Bold(pFont, NULL);
ok(hr == E_POINTER,
"IFont::get_Bold: Expected E_POINTER got 0x%08x\n",
hr);
}
START_TEST(olefont) START_TEST(olefont)
{ {
hOleaut32 = GetModuleHandleA("oleaut32.dll"); hOleaut32 = GetModuleHandleA("oleaut32.dll");
...@@ -827,4 +866,5 @@ START_TEST(olefont) ...@@ -827,4 +866,5 @@ START_TEST(olefont)
test_IsEqual(); test_IsEqual();
test_ReleaseHfont(); test_ReleaseHfont();
test_AddRefHfont(); test_AddRefHfont();
test_returns();
} }
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