Protect from use of a null pointer.

This commit is contained in:
jean-pierre charras 2021-03-19 15:01:03 +01:00
parent 3fec3a3a15
commit 2fc34bf59c
1 changed files with 3 additions and 0 deletions

View File

@ -147,6 +147,9 @@ int COMMON_CONTROL::ShowPlayer( const TOOL_EVENT& aEvent )
FRAME_T playerType = aEvent.Parameter<FRAME_T>(); FRAME_T playerType = aEvent.Parameter<FRAME_T>();
KIWAY_PLAYER* editor = m_frame->Kiway().Player( playerType, true ); KIWAY_PLAYER* editor = m_frame->Kiway().Player( playerType, true );
// editor can be null if Player() fails:
wxCHECK_MSG( editor != nullptr, 0, "Cannot open/create the editor frame" );
// Needed on Windows, other platforms do not use it, but it creates no issue // Needed on Windows, other platforms do not use it, but it creates no issue
if( editor->IsIconized() ) if( editor->IsIconized() )
editor->Iconize( false ); editor->Iconize( false );