diff --git a/src/common/image.cpp b/src/common/image.cpp index 98037f9c39..0bf483822f 100644 --- a/src/common/image.cpp +++ b/src/common/image.cpp @@ -2185,6 +2185,8 @@ unsigned char *wxImage::GetAlpha() const void wxImage::InitAlpha() { + wxCHECK_RET( IsOk(), wxT("invalid image") ); + wxCHECK_RET( !HasAlpha(), wxT("image already has an alpha channel") ); // initialize memory for alpha channel diff --git a/src/msw/imaglist.cpp b/src/msw/imaglist.cpp index c6ef84fd47..3e3a35762e 100644 --- a/src/msw/imaglist.cpp +++ b/src/msw/imaglist.cpp @@ -167,6 +167,12 @@ void wxImageList::GetImageListBitmaps(wxMSWBitmaps& bitmaps, const wxBitmap& bitmap, const wxBitmap& mask) { + if (!bitmap.IsOk()) + { + // We can't do anything with an invalid bitmap. + return; + } + // This can be overwritten below if we need to modify the bitmap, but it // doesn't cost anything to initialize the bitmap with this HBITMAP. bitmaps.hbmp = GetHbitmapOf(bitmap);