Catch IO_ERRORs that we throw
FILEOUTPUT_FORMATTER likes to throw when it gets an issue. We need to catch this to avoid the app falling apart Fixes https://gitlab.com/kicad/code/kicad/issues/11516
This commit is contained in:
parent
08c216e796
commit
4d47857738
|
@ -63,9 +63,20 @@ wxString NETLIST_EXPORTER_PSPICE::GetSpiceDevice( const wxString& aSymbol ) cons
|
||||||
|
|
||||||
bool NETLIST_EXPORTER_PSPICE::WriteNetlist( const wxString& aOutFileName, unsigned aNetlistOptions )
|
bool NETLIST_EXPORTER_PSPICE::WriteNetlist( const wxString& aOutFileName, unsigned aNetlistOptions )
|
||||||
{
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
FILE_OUTPUTFORMATTER outputFile( aOutFileName, wxT( "wt" ), '\'' );
|
FILE_OUTPUTFORMATTER outputFile( aOutFileName, wxT( "wt" ), '\'' );
|
||||||
|
|
||||||
|
|
||||||
return Format( &outputFile, aNetlistOptions );
|
return Format( &outputFile, aNetlistOptions );
|
||||||
|
}
|
||||||
|
catch( IO_ERROR& )
|
||||||
|
{
|
||||||
|
wxString msg;
|
||||||
|
msg.Printf( _( "Failed to create file '%s'." ), aOutFileName );
|
||||||
|
DisplayError( m_schematic, msg );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue