Fix crash in LIBEDIT when editing pins
Units in library items start at 1. 0 is reserved for "all units". Previous code was requesting an out of range index due to an assumption that units start at 0.
This commit is contained in:
parent
9a9c9d38e8
commit
3fa8795f26
|
@ -139,7 +139,7 @@ bool SYMBOL_EDITOR_PIN_TOOL::EditPinProperties( LIB_PIN* aPin )
|
||||||
aPin->GetParent()->GetPins( pinList );
|
aPin->GetParent()->GetPins( pinList );
|
||||||
std::vector<bool> got_unit( aPin->GetParent()->GetUnitCount() );
|
std::vector<bool> got_unit( aPin->GetParent()->GetUnitCount() );
|
||||||
|
|
||||||
got_unit[aPin->GetUnit()] = true;
|
got_unit[static_cast<size_t>(aPin->GetUnit()) - 1] = true;
|
||||||
|
|
||||||
for( LIB_PIN* other : pinList )
|
for( LIB_PIN* other : pinList )
|
||||||
{
|
{
|
||||||
|
@ -149,7 +149,7 @@ bool SYMBOL_EDITOR_PIN_TOOL::EditPinProperties( LIB_PIN* aPin )
|
||||||
/// Only change one pin per unit to allow stacking pins
|
/// Only change one pin per unit to allow stacking pins
|
||||||
/// If you change all units on the position, then pins are not
|
/// If you change all units on the position, then pins are not
|
||||||
/// uniquely editable
|
/// uniquely editable
|
||||||
if( got_unit[other->GetUnit()] )
|
if( got_unit[static_cast<size_t>( other->GetUnit() ) - 1] )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( other->GetPosition() == original_pin.GetPosition()
|
if( other->GetPosition() == original_pin.GetPosition()
|
||||||
|
@ -184,7 +184,7 @@ bool SYMBOL_EDITOR_PIN_TOOL::EditPinProperties( LIB_PIN* aPin )
|
||||||
other->SetNumberTextSize( aPin->GetNumberTextSize() );
|
other->SetNumberTextSize( aPin->GetNumberTextSize() );
|
||||||
|
|
||||||
other->SetModified();
|
other->SetModified();
|
||||||
got_unit[other->GetUnit()] = true;
|
got_unit[static_cast<size_t>( other->GetUnit() ) - 1] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue