Fix a crash when setting a menu icon to a null bitmap in wxQt

Previous implementation didn't take into account that
wxBitmap::GetHandle() could return NULL for wxQt. Specifically when
wxBitmap::IsNull returns true.

Closes https://github.com/wxWidgets/wxWidgets/pull/1071
This commit is contained in:
Graham Dawes
2018-12-12 10:27:11 +00:00
committed by Vadim Zeitlin
parent 331dc1fdfe
commit ac55d06bc1

View File

@@ -111,8 +111,11 @@ void wxMenuItem::SetBitmap(const wxBitmap& bitmap)
if ( m_kind == wxITEM_NORMAL )
{
m_bitmap = bitmap;
if ( !m_bitmap.IsNull() )
{
m_qtAction->setIcon( QIcon(*m_bitmap.GetHandle()) );
}
}
else
{
wxFAIL_MSG("only normal menu items can have bitmaps");