Aric Stewart : windowscodecs/tests: Handle failure to create PNG decoder.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Oct 1 10:57:01 CDT 2015


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

Author: Aric Stewart <aric at codeweavers.com>
Date:   Wed Sep 30 10:54:15 2015 -0500

windowscodecs/tests: Handle failure to create PNG decoder.

Signed-off-by: Aric Stewart <aric at codeweavers.com>

---

 dlls/windowscodecs/tests/pngformat.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/dlls/windowscodecs/tests/pngformat.c b/dlls/windowscodecs/tests/pngformat.c
index bf370a3..34cb533 100644
--- a/dlls/windowscodecs/tests/pngformat.c
+++ b/dlls/windowscodecs/tests/pngformat.c
@@ -295,6 +295,7 @@ static IWICBitmapDecoder *create_decoder(const void *image_data, UINT image_size
 
     hr = IWICImagingFactory_CreateDecoderFromStream(factory, stream, NULL, 0, &decoder);
     ok(hr == S_OK, "CreateDecoderFromStream error %#x\n", hr);
+    if (FAILED(hr)) return NULL;
 
     hr = IWICBitmapDecoder_GetContainerFormat(decoder, &format);
     ok(hr == S_OK, "GetContainerFormat error %#x\n", hr);
@@ -342,6 +343,7 @@ static void test_color_contexts(void)
 
     decoder = create_decoder(png_no_color_profile, sizeof(png_no_color_profile));
     ok(decoder != 0, "Failed to load PNG image data\n");
+    if (!decoder) return;
 
     /* global color context */
     hr = IWICBitmapDecoder_GetColorContexts(decoder, 0, NULL, NULL);
@@ -369,6 +371,7 @@ static void test_color_contexts(void)
 
     decoder = create_decoder(png_color_profile, sizeof(png_color_profile));
     ok(decoder != 0, "Failed to load PNG image data\n");
+    if (!decoder) return;
 
     /* global color context */
     count = 0xdeadbeef;
@@ -546,6 +549,7 @@ static void test_png_palette(void)
 
     decoder = create_decoder(png_PLTE_tRNS, sizeof(png_PLTE_tRNS));
     ok(decoder != 0, "Failed to load PNG image data\n");
+    if (!decoder) return;
 
     hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
     ok(hr == S_OK, "GetFrame error %#x\n", hr);




More information about the wine-cvs mailing list