Browse Source

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
7.0
Seth Hillbrand 3 years ago
parent
commit
359d66bc81
  1. 3
      pcbnew/pad.cpp

3
pcbnew/pad.cpp

@ -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();
}

Loading…
Cancel
Save