- if( LoadJPGBuff( buffer, size, &pixels, &width, &height ) == -1 && pixels != NULL )
- Sys_Printf( "WARNING: LoadJPGBuff: %s\n", (unsigned char*) image->pixels );
- if(pixels && width == image->width && height == image->height)
- {
- int i;
- for(i = 0; i < width*height; ++i)
- image->pixels[4*i+3] = pixels[4*i+2]; // copy alpha from blue channel
+ if ( LoadJPGBuff( buffer, size, &pixels, &width, &height ) == -1 ) {
+ if (pixels) {
+ // On error, LoadJPGBuff might store a pointer to the error message in pixels
+ Sys_Printf( "WARNING: LoadJPGBuff %s %s\n", name, (unsigned char*) pixels );
+ }
+ } else {
+ if ( width == image->width && height == image->height ) {
+ int i;
+ for ( i = 0; i < width * height; ++i )
+ image->pixels[4 * i + 3] = pixels[4 * i + 2]; // copy alpha from blue channel
+ }
+ free( pixels );