Always create wxStaticBitmap in the widgets sample
Not creating it when the default image wasn't found resulted in a crash, so always create wxStaticBitmap using a fallback bitmap if necessary. Also add a wxCHECK_RET to prevent the crash from happening in a similar situation in the future.
This commit is contained in:
@@ -680,8 +680,11 @@ void WidgetsFrame::ConnectToWidgetEvents()
|
||||
it != widgets.end();
|
||||
++it )
|
||||
{
|
||||
(*it)->Bind(wxEVT_SET_FOCUS, &WidgetsFrame::OnWidgetFocus, this);
|
||||
(*it)->Bind(wxEVT_KILL_FOCUS, &WidgetsFrame::OnWidgetFocus, this);
|
||||
wxWindow* const w = *it;
|
||||
wxCHECK_RET(w, "NULL widget");
|
||||
|
||||
w->Bind(wxEVT_SET_FOCUS, &WidgetsFrame::OnWidgetFocus, this);
|
||||
w->Bind(wxEVT_KILL_FOCUS, &WidgetsFrame::OnWidgetFocus, this);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user