Jeff Young 2022-12-26 14:30:57 +00:00
parent f214f6f44c
commit 424cdf6699
1 changed files with 3 additions and 2 deletions

View File

@ -666,6 +666,7 @@ std::vector<std::reference_wrapper<const SIM_MODEL::PIN>> SIM_MODEL::GetPins() c
void SIM_MODEL::SetPinSymbolPinNumber( int aPinIndex, const std::string& aSymbolPinNumber ) void SIM_MODEL::SetPinSymbolPinNumber( int aPinIndex, const std::string& aSymbolPinNumber )
{ {
if( aPinIndex >= 0 && aPinIndex < (int) m_pins.size() )
m_pins.at( aPinIndex ).symbolPinNumber = aSymbolPinNumber; m_pins.at( aPinIndex ).symbolPinNumber = aSymbolPinNumber;
} }
@ -686,7 +687,7 @@ void SIM_MODEL::SetPinSymbolPinNumber( const std::string& aPinName,
// for legacy files which didn't use pin names. // for legacy files which didn't use pin names.
int aPinIndex = (int) strtol( aPinName.c_str(), nullptr, 10 ); int aPinIndex = (int) strtol( aPinName.c_str(), nullptr, 10 );
if( aPinIndex < 1 ) if( aPinIndex < 1 || aPinIndex > (int) m_pins.size() )
{ {
THROW_IO_ERROR( wxString::Format( _( "Could not find a pin named '%s' in simulation " THROW_IO_ERROR( wxString::Format( _( "Could not find a pin named '%s' in simulation "
"model of type '%s'" ), "model of type '%s'" ),