Avoid crash in wxBitmap::GetImage() for invalid bitmaps

Just return NULL from this (wxOSX private, in spite of not using a
port-specific prefix) method.

This fixes crash in wxButton::SetBitmapXXX(wxNullBitmap), as shown by
the new test case which used to crash but doesn't do it any longer.

Closes #19257.
This commit is contained in:
Vadim Zeitlin
2021-09-03 00:28:58 +02:00
parent 0455e25302
commit ff4cd70412
3 changed files with 7 additions and 1 deletions

View File

@@ -204,6 +204,7 @@ public:
// returns a CGImageRef which must released after usage with CGImageRelease
CGImageRef CreateCGImage() const ;
// returns nil for invalid bitmap
WXImage GetImage() const;
#if wxOSX_USE_COCOA
// returns an autoreleased version of the image