From b2427428a2f7b6009db88dfc75260fab61bc20a7 Mon Sep 17 00:00:00 2001 From: divverent Date: Mon, 20 Feb 2012 12:28:09 +0000 Subject: [PATCH] fix a crash when JPEG loading when alpha image is corrupt git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11703 d7cf8633-e32d-0410-b094-e92efae38249 ::stable-branch::merge=6c88529e0783c59bbb145a7d84b29127cfbcf4ef --- image.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/image.c b/image.c index 988fbef8..4f85e83e 100644 --- a/image.c +++ b/image.c @@ -966,11 +966,13 @@ unsigned char *loadimagepixelsbgra (const char *filename, qboolean complain, qbo { int mymiplevel2 = miplevel ? *miplevel : 0; data2 = format->loadfunc(f, (int)filesize, &mymiplevel2); - if(mymiplevel != mymiplevel2) - Host_Error("loadimagepixelsbgra: miplevels differ"); + if(data2 && mymiplevel == mymiplevel2) + Image_CopyAlphaFromBlueBGRA(data, data2, image_width, image_height); + else + Con_Printf("loadimagepixelsrgba: corrupt or invalid alpha image %s_alpha\n", basename); + if(data2) + Mem_Free(data2); Mem_Free(f); - Image_CopyAlphaFromBlueBGRA(data, data2, image_width, image_height); - Mem_Free(data2); } } if (developer_loading.integer) -- 2.39.2