Eeschema sim dialog: Fix kicad crash when spice model corrupted
This commit is contained in:
committed by
jean-pierre charras
parent
17c746c00a
commit
b06727d295
@@ -845,10 +845,13 @@ bool DIALOG_SIM_MODEL<T>::loadLibrary( const wxString& aLibraryPath, REPORTER& a
|
||||
m_modelListBoxEntryToLibraryIdx.clear();
|
||||
wxArrayString modelNames;
|
||||
|
||||
bool modelNameExists = false;
|
||||
for( const auto& [name, model] : library()->GetModels() )
|
||||
{
|
||||
modelNames.Add( name );
|
||||
m_modelListBoxEntryToLibraryIdx[name] = m_modelListBoxEntryToLibraryIdx.size();
|
||||
if( name == modelName )
|
||||
modelNameExists = true;
|
||||
}
|
||||
|
||||
modelNames.Sort();
|
||||
@@ -856,6 +859,13 @@ bool DIALOG_SIM_MODEL<T>::loadLibrary( const wxString& aLibraryPath, REPORTER& a
|
||||
m_modelListBox->Clear();
|
||||
m_modelListBox->Append( modelNames );
|
||||
|
||||
if( !modelNameExists )
|
||||
{
|
||||
m_infoBar->ShowMessage(
|
||||
wxString::Format( _( "No model named '%s' in '%s'." ), modelName, aLibraryPath ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
if( isIbisLoaded() )
|
||||
{
|
||||
wxArrayString emptyArray;
|
||||
|
||||
Reference in New Issue
Block a user