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:
@@ -951,7 +951,7 @@ bool wxBitmap::Create(CGContextRef bitmapcontext)
|
||||
|
||||
WXImage wxBitmap::GetImage() const
|
||||
{
|
||||
return GetBitmapData()->GetImage();
|
||||
return IsOk() ? GetBitmapData()->GetImage() : NULL;
|
||||
}
|
||||
|
||||
wxBitmap wxBitmap::GetSubBitmap(const wxRect &rect) const
|
||||
|
Reference in New Issue
Block a user