Allow for empty LIB_PART in certain symbol functions
Fixes https://gitlab.com/kicad/code/kicad/-/issues/16731
(cherry picked from commit 5d7eac7677
)
This commit is contained in:
parent
819f75e17c
commit
c579e11db4
|
@ -1164,8 +1164,11 @@ std::vector<SCH_PIN*> SCH_SYMBOL::GetPins( const SCH_SHEET_PATH* aSheet ) const
|
|||
|
||||
for( const std::unique_ptr<SCH_PIN>& p : m_pins )
|
||||
{
|
||||
if( unit && p->GetLibPin()->GetUnit() && ( p->GetLibPin()->GetUnit() != unit ) )
|
||||
if( unit && p->GetLibPin() && p->GetLibPin()->GetUnit()
|
||||
&& ( p->GetLibPin()->GetUnit() != unit ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
pins.push_back( p.get() );
|
||||
}
|
||||
|
@ -1942,7 +1945,7 @@ void SCH_SYMBOL::GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList )
|
|||
{
|
||||
LIB_PIN* lib_pin = pin->GetLibPin();
|
||||
|
||||
if( lib_pin->GetUnit() && m_unit && ( m_unit != lib_pin->GetUnit() ) )
|
||||
if( lib_pin && lib_pin->GetUnit() && m_unit && ( m_unit != lib_pin->GetUnit() ) )
|
||||
continue;
|
||||
|
||||
DANGLING_END_ITEM item( PIN_END, lib_pin, GetPinPhysicalPosition( lib_pin ), this );
|
||||
|
@ -2018,8 +2021,8 @@ std::vector<VECTOR2I> SCH_SYMBOL::GetConnectionPoints() const
|
|||
{
|
||||
// Collect only pins attached to the current unit and convert.
|
||||
// others are not associated to this symbol instance
|
||||
int pin_unit = pin->GetLibPin()->GetUnit();
|
||||
int pin_convert = pin->GetLibPin()->GetConvert();
|
||||
int pin_unit = pin->GetLibPin() ? pin->GetLibPin()->GetUnit() : GetUnit();
|
||||
int pin_convert = pin->GetLibPin() ? pin->GetLibPin()->GetConvert() : GetConvert();
|
||||
|
||||
if( pin_unit > 0 && pin_unit != GetUnit() )
|
||||
continue;
|
||||
|
@ -2109,8 +2112,8 @@ INSPECT_RESULT SCH_SYMBOL::Visit( INSPECTOR aInspector, void* aTestData,
|
|||
{
|
||||
// Collect only pins attached to the current unit and convert.
|
||||
// others are not associated to this symbol instance
|
||||
int pin_unit = pin->GetLibPin()->GetUnit();
|
||||
int pin_convert = pin->GetLibPin()->GetConvert();
|
||||
int pin_unit = pin->GetLibPin() ? pin->GetLibPin()->GetUnit() : GetUnit();
|
||||
int pin_convert = pin->GetLibPin() ? pin->GetLibPin()->GetConvert() : GetConvert();
|
||||
|
||||
if( pin_unit > 0 && pin_unit != GetUnit() )
|
||||
continue;
|
||||
|
@ -2247,8 +2250,8 @@ bool SCH_SYMBOL::doIsConnected( const VECTOR2I& aPosition ) const
|
|||
|
||||
// Collect only pins attached to the current unit and convert.
|
||||
// others are not associated to this symbol instance
|
||||
int pin_unit = pin->GetLibPin()->GetUnit();
|
||||
int pin_convert = pin->GetLibPin()->GetConvert();
|
||||
int pin_unit = pin->GetLibPin() ? pin->GetLibPin()->GetUnit() : GetUnit();
|
||||
int pin_convert = pin->GetLibPin() ? pin->GetLibPin()->GetConvert() : GetConvert();
|
||||
|
||||
if( pin_unit > 0 && pin_unit != GetUnit() )
|
||||
continue;
|
||||
|
@ -2430,8 +2433,8 @@ bool SCH_SYMBOL::IsPointClickableAnchor( const VECTOR2I& aPos ) const
|
|||
{
|
||||
for( const std::unique_ptr<SCH_PIN>& pin : m_pins )
|
||||
{
|
||||
int pin_unit = pin->GetLibPin()->GetUnit();
|
||||
int pin_convert = pin->GetLibPin()->GetConvert();
|
||||
int pin_unit = pin->GetLibPin() ? pin->GetLibPin()->GetUnit() : GetUnit();
|
||||
int pin_convert = pin->GetLibPin() ? pin->GetLibPin()->GetConvert() : GetConvert();
|
||||
|
||||
if( pin_unit > 0 && pin_unit != GetUnit() )
|
||||
continue;
|
||||
|
|
Loading…
Reference in New Issue