Better bounds checking for DIALOG_SIM_MODEL::curModel().

Fixes https://gitlab.com/kicad/code/kicad/issues/13767
This commit is contained in:
Jeff Young 2023-02-04 20:16:28 +00:00
parent 56a1cdb4dc
commit 9be872a85a
1 changed files with 2 additions and 2 deletions

View File

@ -923,8 +923,8 @@ SIM_MODEL& DIALOG_SIM_MODEL<T_symbol, T_field>::curModel() const
{ {
int sel = m_modelNameChoice->GetSelection(); int sel = m_modelNameChoice->GetSelection();
if( sel >= 0 && sel < (int) m_modelNameChoice->GetCount() ) if( sel >= 0 && sel < (int) m_libraryModelsMgr.GetModels().size() )
return m_libraryModelsMgr.GetModels().at( m_modelNameChoice->GetSelection() ).get(); return m_libraryModelsMgr.GetModels().at( sel ).get();
} }
else else
{ {