Nikolay Sivov : mfplat: Handle null destination for GetItem().

Alexandre Julliard julliard at winehq.org
Fri May 17 16:10:15 CDT 2019


Module: wine
Branch: master
Commit: e1d23a336eb00a0480847d2d6c3951bc1560b59b
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=e1d23a336eb00a0480847d2d6c3951bc1560b59b

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Fri May 17 15:35:22 2019 +0300

mfplat: Handle null destination for GetItem().

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 14b9e23..e80408d 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 3afb330..7fa3ddd 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;




More information about the wine-cvs mailing list