From fe01c9d286b55485fc241f42a617a3a75f2553c4 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Thu, 27 Oct 2016 14:50:03 +0800
Subject: windowscodecs: Fix IWICBitmapDecoder::CopyPalette for a not
 initialized case in the GIF decoder.

---
 dlls/windowscodecs/gifformat.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/dlls/windowscodecs/gifformat.c b/dlls/windowscodecs/gifformat.c
index 6052726..3dac59e 100644
--- a/dlls/windowscodecs/gifformat.c
+++ b/dlls/windowscodecs/gifformat.c
@@ -1198,6 +1198,9 @@ static HRESULT WINAPI GifDecoder_CopyPalette(IWICBitmapDecoder *iface, IWICPalet
 
     TRACE("(%p,%p)\n", iface, palette);
 
+    if (!This->gif)
+        return WINCODEC_ERR_WRONGSTATE;
+
     cm = This->gif->SColorMap;
     if (cm)
     {
-- 
2.9.0

