From ac55d06bc194acf704b1b6b10ad73ded8d9de779 Mon Sep 17 00:00:00 2001 From: Graham Dawes Date: Wed, 12 Dec 2018 10:27:11 +0000 Subject: [PATCH] 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 --- src/qt/menuitem.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/qt/menuitem.cpp b/src/qt/menuitem.cpp index fa729e33de..59f82e32a2 100644 --- a/src/qt/menuitem.cpp +++ b/src/qt/menuitem.cpp @@ -111,7 +111,10 @@ void wxMenuItem::SetBitmap(const wxBitmap& bitmap) if ( m_kind == wxITEM_NORMAL ) { m_bitmap = bitmap; - m_qtAction->setIcon( QIcon( *m_bitmap.GetHandle() ) ); + if ( !m_bitmap.IsNull() ) + { + m_qtAction->setIcon( QIcon(*m_bitmap.GetHandle()) ); + } } else {