7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-04 23:05:30 +00:00

Eeschema sim dialog: Fix kicad crash when spice model corrupted

This commit is contained in:
lucas 2025-01-11 11:03:03 -05:00 committed by jean-pierre charras
parent 17c746c00a
commit b06727d295

View File

@ -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;