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
(cherry picked from commit 4d47857738
)
This commit is contained in:
parent
f6f316bd8c
commit
2079d15b3f
|
@ -94,11 +94,22 @@ NETLIST_EXPORTER_PSPICE::GetSpiceTuningCommand( const wxString& aSymbol ) const
|
||||||
|
|
||||||
|
|
||||||
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void NETLIST_EXPORTER_PSPICE::ReplaceForbiddenChars( wxString &aNetName )
|
void NETLIST_EXPORTER_PSPICE::ReplaceForbiddenChars( wxString &aNetName )
|
||||||
|
|
Loading…
Reference in New Issue