test for dst!=NULL instead of bpp==1 in Rescale() as otherwise we'd crash on monochrome display (not very common any more, but still) (coverity checker CID 12)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37888 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2006-03-07 23:52:46 +00:00
parent d6a7ca317f
commit ce46daf91c

View File

@@ -455,7 +455,7 @@ wxBitmap wxBitmap::Rescale( int clipx, int clipy, int clipwidth, int clipheight,
old_x = x; old_x = x;
} }
if (bpp == 1) if ( dst )
{ {
if (!pixval) if (!pixval)
{ {
@@ -480,14 +480,14 @@ wxBitmap wxBitmap::Rescale( int clipx, int clipy, int clipwidth, int clipheight,
} }
// do not forget the last byte // do not forget the last byte
if ((bpp == 1) && (width % 8 != 0)) if ( dst && (width % 8 != 0) )
dst[h*dstbyteperline+width/8] = outbyte; dst[h*dstbyteperline+width/8] = outbyte;
} }
gdk_image_destroy( img ); gdk_image_destroy( img );
if (gc) gdk_gc_unref( gc ); if (gc) gdk_gc_unref( gc );
if (bpp == 1) if ( dst )
{ {
bmp = wxBitmap( (const char *)dst, width, height, 1 ); bmp = wxBitmap( (const char *)dst, width, height, 1 );
free( dst ); free( dst );