Protect against invalid pads

Before dereferencing the front of the sequence, we have to ensure that
the pad exists on any layer.  If not, just return the default (probably
F_Cu) for the element
This commit is contained in:
Seth Hillbrand 2022-06-16 08:20:47 -07:00
parent 34e706bcbc
commit 359d66bc81
1 changed files with 2 additions and 1 deletions

View File

@ -209,10 +209,11 @@ PCB_LAYER_ID PAD::GetLayer() const
PCB_LAYER_ID PAD::GetPrincipalLayer() const
{
if( m_attribute == PAD_ATTRIB::SMD || m_attribute == PAD_ATTRIB::CONN )
if( m_attribute == PAD_ATTRIB::SMD || m_attribute == PAD_ATTRIB::CONN || GetLayerSet().none() )
return m_layer;
else
return GetLayerSet().Seq().front();
}