From e1d23a336eb00a0480847d2d6c3951bc1560b59b Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Fri, 17 May 2019 15:35:22 +0300 Subject: [PATCH] mfplat: Handle null destination for GetItem(). Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/mfplat/main.c | 2 +- dlls/mfplat/tests/mfplat.c | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c index 14b9e2376aa..e80408d2b2a 100644 --- a/dlls/mfplat/main.c +++ b/dlls/mfplat/main.c @@ -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; diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 3afb3300a8a..7fa3ddd8764 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -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;