[PATCH] ole32: Fix regression in OLE's data cache test.

Sergio Gómez Del Real sdelreal at codeweavers.com
Mon Dec 11 12:33:47 CST 2017


Regression is reported at https://bugs.winehq.org/show_bug.cgi?id=44147

Signed-off-by: Sergio Gómez Del Real <sdelreal at codeweavers.com>
---
 dlls/ole32/datacache.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/dlls/ole32/datacache.c b/dlls/ole32/datacache.c
index 75c961164e..ae05b8e176 100644
--- a/dlls/ole32/datacache.c
+++ b/dlls/ole32/datacache.c
@@ -792,8 +792,14 @@ static void init_stream_header(DataCacheEntry *entry, PresentationDataHeader *he
 static HRESULT save_dib(DataCacheEntry *entry, BOOL contents, IStream *stream)
 {
     HRESULT hr = S_OK;
-    int data_size = GlobalSize(entry->stgmedium.u.hGlobal);
-    BITMAPINFO *bmi = GlobalLock(entry->stgmedium.u.hGlobal);
+    int data_size = 0;
+    BITMAPINFO *bmi = NULL;
+
+    if (entry->stgmedium.tymed != TYMED_NULL)
+    {
+        data_size = GlobalSize(entry->stgmedium.u.hGlobal);
+        bmi = GlobalLock(entry->stgmedium.u.hGlobal);
+    }
 
     if (!contents)
     {
-- 
2.14.1




More information about the wine-devel mailing list