mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-08 23:46:24 -06:00
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);
|
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…
Add table
Add a link
Reference in a new issue