From 179daf67a82945ee41f45f24d4bbf8f31fc2d7d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20G=C3=B3mez=20Del=20Real?= Date: Thu, 14 Dec 2017 13:17:37 +0000 Subject: [PATCH] ole32: Correctly save the dib format if its data has not been set. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Sergio Gómez Del Real Signed-off-by: Huw Davies Signed-off-by: Alexandre Julliard --- 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 75c961164e2..ae05b8e1768 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) {