pcbnew: Fix crash with differential routing

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14537

(cherry picked from commit 469fe76994)
This commit is contained in:
Lucas Dumont 2023-04-17 14:13:36 +12:00 committed by Jeff Young
parent 204549f55b
commit 0736c141b9
2 changed files with 7 additions and 6 deletions

View File

@ -140,7 +140,7 @@ const SHAPE_LINE_CHAIN VIA::Hull( int aClearance, int aWalkaroundThickness, int
int cl = ( aClearance + aWalkaroundThickness / 2 );
int width = m_diameter;
if( !ROUTER::GetInstance()->GetInterface()->IsFlashedOnLayer( this, aLayer ) )
if( m_hole && !ROUTER::GetInstance()->GetInterface()->IsFlashedOnLayer( this, aLayer ) )
width = m_hole->Radius() * 2;
// Chamfer = width * ( 1 - sqrt(2)/2 ) for equilateral octagon
@ -160,6 +160,7 @@ VIA* VIA::Clone() const
v->m_diameter = m_diameter;
v->m_drill = m_drill;
v->m_shape = SHAPE_CIRCLE( m_pos, m_diameter / 2 );
delete v->m_hole;
v->m_hole = m_hole->Clone();
v->m_rank = m_rank;
v->m_marker = m_marker;

View File

@ -53,12 +53,12 @@ public:
VIA() :
LINKED_ITEM( VIA_T )
{
m_diameter = 2; // Dummy value
m_drill = 0;
m_viaType = VIATYPE::THROUGH;
m_isFree = false;
m_diameter = 2; // Dummy value
m_drill = 0;
m_viaType = VIATYPE::THROUGH;
m_isFree = false;
m_isVirtual = false;
m_hole = nullptr;
m_hole = HOLE::MakeCircularHole( m_pos, m_diameter / 2 );
}
VIA( const VECTOR2I& aPos, const LAYER_RANGE& aLayers, int aDiameter, int aDrill,