[PATCH 1/2] mfplat: Handle null destination for GetItem().
Nikolay Sivov
nsivov at codeweavers.com
Fri May 17 07:35:22 CDT 2019
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
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 14b9e2376a..e80408d2b2 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 3afb3300a8..7fa3ddd876 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;
--
2.20.1
More information about the wine-devel
mailing list