mfplat: Handle null destination for GetItem().

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2019-05-17 15:35:22 +03:00 committed by Alexandre Julliard
parent 39cc121640
commit e1d23a336e
2 changed files with 7 additions and 1 deletions

View File

@ -1112,7 +1112,7 @@ HRESULT attributes_GetItem(struct attributes *attributes, REFGUID key, PROPVARIA
EnterCriticalSection(&attributes->cs);
if ((attribute = attributes_find_item(attributes, key, NULL)))
hr = PropVariantCopy(value, &attribute->value);
hr = value ? PropVariantCopy(value, &attribute->value) : S_OK;
else
hr = MF_E_ATTRIBUTENOTFOUND;

View File

@ -763,6 +763,12 @@ static void test_attributes(void)
PropVariantClear(&ret_propvar);
CHECK_ATTR_COUNT(attributes, 1);
hr = IMFAttributes_GetItem(attributes, &DUMMY_GUID1, NULL);
ok(hr == S_OK, "Item check failed, hr %#x.\n", hr);
hr = IMFAttributes_GetItem(attributes, &DUMMY_GUID2, NULL);
ok(hr == MF_E_ATTRIBUTENOTFOUND, "Unexpected hr %#x.\n", hr);
PropVariantInit(&ret_propvar);
ret_propvar.vt = MF_ATTRIBUTE_STRING;
U(ret_propvar).pwszVal = NULL;