Catch exception so that we at least throw up an error message.

Fixes https://gitlab.com/kicad/code/kicad/issues/4677
This commit is contained in:
Jeff Young 2020-07-13 21:21:34 +01:00
parent dd61f6f019
commit 940570e9ec
3 changed files with 22 additions and 25 deletions

View File

@ -116,20 +116,14 @@ static FOOTPRINT_LIST* get_instance_from_id( KIWAY& aKiway, int aId )
{
KIFACE* kiface = aKiway.KiFACE( KIWAY::FACE_PCB );
if( !kiface )
return nullptr;
ptr = kiface->IfaceOrAddress( aId );
if( !ptr )
return nullptr;
return static_cast<FOOTPRINT_LIST*>( ptr );
}
catch( ... )
{
return nullptr;
}
return static_cast<FOOTPRINT_LIST*>( ptr );
}

View File

@ -36,7 +36,7 @@
#include <wx/stdpaths.h>
#include <wx/debug.h>
#include <wx/utils.h>
#include <confirm.h>
KIFACE* KIWAY::m_kiface[KIWAY_FACE_COUNT];
int KIWAY::m_kiface_version[KIWAY_FACE_COUNT];
@ -360,27 +360,31 @@ KIWAY_PLAYER* KIWAY::Player( FRAME_T aFrameType, bool doCreate, wxTopLevelWindow
if( doCreate )
{
FACE_T face_type = KifaceType( aFrameType );
wxASSERT( face_type != FACE_T(-1) );
KIFACE* kiface = KiFACE( face_type );
wxASSERT( kiface );
if( kiface )
try
{
FACE_T face_type = KifaceType( aFrameType );
KIFACE* kiface = KiFACE( face_type );
frame = (KIWAY_PLAYER*) kiface->CreateWindow(
aParent, // Parent window of frame in modal mode, NULL in non modal mode
aParent, // Parent window of frame in modal mode,
// NULL in non modal mode
aFrameType,
this,
m_ctl // questionable need, these same flags where passed
// to the KIFACE::OnKifaceStart()
m_ctl // questionable need, these same flags
// were passed to KIFACE::OnKifaceStart()
);
wxASSERT( frame );
m_playerFrameName[aFrameType] = frame->GetName();
return frame;
}
catch( const IO_ERROR& ioe )
{
DisplayErrorMessage( NULL, _( "Error loading editor" ), ioe.What() );
}
catch( ... )
{
DisplayErrorMessage( NULL, _( "Error loading editor" ) );
}
}
return NULL;

View File

@ -101,7 +101,6 @@ int COMMON_CONTROL::ConfigurePaths( const TOOL_EVENT& aEvent )
m_frame->Kiway().CommonSettingsChanged( true );
}
return 0;
}