Improve exception handling in KIWAY::Player()
And avoid crashing in kicad_manager_control
This commit is contained in:
parent
11e61db03d
commit
e5828d5817
|
@ -382,6 +382,10 @@ KIWAY_PLAYER* KIWAY::Player( FRAME_T aFrameType, bool doCreate, wxTopLevelWindow
|
||||||
{
|
{
|
||||||
DisplayErrorMessage( NULL, _( "Error loading editor" ), ioe.What() );
|
DisplayErrorMessage( NULL, _( "Error loading editor" ), ioe.What() );
|
||||||
}
|
}
|
||||||
|
catch ( const std::exception& e)
|
||||||
|
{
|
||||||
|
DisplayErrorMessage( NULL, _( "Error loading editor" ), e.what() );
|
||||||
|
}
|
||||||
catch( ... )
|
catch( ... )
|
||||||
{
|
{
|
||||||
DisplayErrorMessage( NULL, _( "Error loading editor" ) );
|
DisplayErrorMessage( NULL, _( "Error loading editor" ) );
|
||||||
|
|
|
@ -603,6 +603,13 @@ int KICAD_MANAGER_CONTROL::ShowPlayer( const TOOL_EVENT& aEvent )
|
||||||
return -1;
|
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.
|
if( !player->IsVisible() ) // A hidden frame might not have the document loaded.
|
||||||
{
|
{
|
||||||
wxString filepath;
|
wxString filepath;
|
||||||
|
|
Loading…
Reference in New Issue