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
2bbec00080
commit
f8c718fd1f
|
@ -1585,6 +1585,8 @@ void ColourPicker::set_undef_value(wxColourPickerCtrl* field)
|
||||||
field->SetColour(wxTransparentColour);
|
field->SetColour(wxTransparentColour);
|
||||||
|
|
||||||
wxButton* btn = dynamic_cast<wxButton*>(field->GetPickerCtrl());
|
wxButton* btn = dynamic_cast<wxButton*>(field->GetPickerCtrl());
|
||||||
|
if (!btn->GetBitmap().IsOk()) return;
|
||||||
|
|
||||||
wxImage image(btn->GetBitmap().GetSize());
|
wxImage image(btn->GetBitmap().GetSize());
|
||||||
image.InitAlpha();
|
image.InitAlpha();
|
||||||
memset(image.GetAlpha(), 0, image.GetWidth() * image.GetHeight());
|
memset(image.GetAlpha(), 0, image.GetWidth() * image.GetHeight());
|
||||||
|
|
Loading…
Reference in New Issue