GUI/Field: Fix crash in color picker init (#2220)
wxButton->GetBitmap() may return an invalid wxBitmap. Guard against this.
This commit is contained in:
parent
3b864e562a
commit
ec90d7f3e4
1 changed files with 2 additions and 0 deletions
|
@ -1539,6 +1539,8 @@ void ColourPicker::set_undef_value(wxColourPickerCtrl* field)
|
|||
field->SetColour(wxTransparentColour);
|
||||
|
||||
wxButton* btn = dynamic_cast<wxButton*>(field->GetPickerCtrl());
|
||||
if (!btn->GetBitmap().IsOk()) return;
|
||||
|
||||
wxImage image(btn->GetBitmap().GetSize());
|
||||
image.InitAlpha();
|
||||
memset(image.GetAlpha(), 0, image.GetWidth() * image.GetHeight());
|
||||
|
|
Loading…
Reference in a new issue