Improve exception handling in KIWAY::Player()

And avoid crashing in kicad_manager_control
This commit is contained in:
qu1ck 2020-09-06 23:18:37 -07:00
parent 11e61db03d
commit e5828d5817
2 changed files with 11 additions and 0 deletions

View File

@ -382,6 +382,10 @@ KIWAY_PLAYER* KIWAY::Player( FRAME_T aFrameType, bool doCreate, wxTopLevelWindow
{
DisplayErrorMessage( NULL, _( "Error loading editor" ), ioe.What() );
}
catch ( const std::exception& e)
{
DisplayErrorMessage( NULL, _( "Error loading editor" ), e.what() );
}
catch( ... )
{
DisplayErrorMessage( NULL, _( "Error loading editor" ) );

View File

@ -603,6 +603,13 @@ int KICAD_MANAGER_CONTROL::ShowPlayer( const TOOL_EVENT& aEvent )
return -1;
}
if ( !player )
{
wxMessageBox( _( "Application failed to load." ), _( "KiCad Error" ),
wxOK | wxICON_ERROR, m_frame );
return -1;
}
if( !player->IsVisible() ) // A hidden frame might not have the document loaded.
{
wxString filepath;