From aa8dbc03a2fdf943c22268c31685bae5a0240b8a Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 26 Jun 2023 21:59:57 +0100 Subject: [PATCH] Error reporting for missing ltspice symbol (.asy) files. --- eeschema/sch_plugins/ltspice/ltspice_schematic.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/eeschema/sch_plugins/ltspice/ltspice_schematic.cpp b/eeschema/sch_plugins/ltspice/ltspice_schematic.cpp index 2f28403e2a..307089c55f 100644 --- a/eeschema/sch_plugins/ltspice/ltspice_schematic.cpp +++ b/eeschema/sch_plugins/ltspice/ltspice_schematic.cpp @@ -463,7 +463,12 @@ void LTSPICE_SCHEMATIC::removeCarriageReturn( wxString& elementFromLine ) LTSPICE_SCHEMATIC::LT_SYMBOL LTSPICE_SCHEMATIC::SymbolBuilder( const wxString& aAscFileName, LT_ASC& aAscFile ) { - return SymbolBuilder( aAscFileName, m_fileCache[ wxS( "asyFiles" ) ][ aAscFileName ], aAscFile ); + const std::map& asyFiles = m_fileCache[ wxS( "asyFiles" ) ]; + + if( !asyFiles.count( aAscFileName ) ) + THROW_IO_ERROR( wxString::Format( _( "Symbol '%s.asy' not found" ), aAscFileName ) ); + + return SymbolBuilder( aAscFileName, asyFiles.at( aAscFileName ), aAscFile ); } LTSPICE_SCHEMATIC::LT_SYMBOL LTSPICE_SCHEMATIC::SymbolBuilder( const wxString& aAscFileName,