From ba202c6ce9849c12592abc097e05074d5247ccfd Mon Sep 17 00:00:00 2001 From: Pavel Krajcevski Date: Tue, 19 Nov 2013 12:00:12 -0500 Subject: [PATCH] Fix assert to not cause warning in release and do some sane things... --- IO/src/ImageLoaderPNG.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/IO/src/ImageLoaderPNG.cpp b/IO/src/ImageLoaderPNG.cpp index 332279d..f8310c0 100644 --- a/IO/src/ImageLoaderPNG.cpp +++ b/IO/src/ImageLoaderPNG.cpp @@ -156,7 +156,13 @@ bool ImageLoaderPNG::ReadData() { png_colorp palette; int nPaletteEntries; png_uint_32 ret = png_get_PLTE(png_ptr, info_ptr, &palette, &nPaletteEntries); - assert(ret == PNG_INFO_PLTE); + if(ret != PNG_INFO_PLTE) { + memset(m_BlueData, 0, numPixels); + memset(m_RedData, 0, numPixels); + memset(m_GreenData, 0, numPixels); + assert(!"Couldn't find PLTE chunk"); + break; + } for(uint32 i = 0; i < m_Height; i++) { png_read_row(png_ptr, rowData, NULL);