dwrite: Handle NULL path in CreateFontFileReference().

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
oldstable
Nikolay Sivov 2016-04-20 10:50:59 +03:00 committed by Alexandre Julliard
parent 8b8098461d
commit af18a09862
3 changed files with 10 additions and 0 deletions

View File

@ -4399,6 +4399,9 @@ HRESULT get_local_refkey(const WCHAR *path, const FILETIME *writetime, void **ke
{
struct local_refkey *refkey;
if (!path)
return E_INVALIDARG;
*size = FIELD_OFFSET(struct local_refkey, name) + (strlenW(path)+1)*sizeof(WCHAR);
*key = NULL;

View File

@ -778,6 +778,8 @@ static HRESULT WINAPI dwritefactory_CreateFontFileReference(IDWriteFactory3 *ifa
TRACE("(%p)->(%s %p %p)\n", This, debugstr_w(path), writetime, font_file);
*font_file = NULL;
if (!This->localfontfileloader)
{
hr = create_localfontfileloader(&This->localfontfileloader);

View File

@ -2599,6 +2599,11 @@ static void test_CreateFontFileReference(void)
path = create_testfontfile(test_fontfile);
factory = create_factory();
ffile = (void*)0xdeadbeef;
hr = IDWriteFactory_CreateFontFileReference(factory, NULL, NULL, &ffile);
ok(hr == E_INVALIDARG, "got 0x%08x\n",hr);
ok(ffile == NULL, "got %p\n", ffile);
hr = IDWriteFactory_CreateFontFileReference(factory, path, NULL, &ffile);
ok(hr == S_OK, "got 0x%08x\n",hr);