Pcbnew: fix exception when importing pcad pcb with zero size pads (fixes lp: 1551353)

* Zero size pads are now just ignored.
This commit is contained in:
Eldar Khayrullin 2016-03-14 09:13:53 -04:00 committed by Wayne Stambaugh
parent cc058033cc
commit 286f6a426b
1 changed files with 9 additions and 6 deletions

View File

@ -195,8 +195,6 @@ void PCB_PAD::AddToModule( MODULE* aModule, int aRotation, bool aEncapsulatedPad
D_PAD* pad = new D_PAD( aModule ); D_PAD* pad = new D_PAD( aModule );
aModule->Pads().PushBack( pad );
if( !m_isHolePlated && m_hole ) if( !m_isHolePlated && m_hole )
{ {
// mechanical hole // mechanical hole
@ -237,13 +235,16 @@ void PCB_PAD::AddToModule( MODULE* aModule, int aRotation, bool aEncapsulatedPad
} }
} }
if( width == 0 || height == 0 )
{
delete pad;
return;
}
if( padType == PAD_ATTRIB_STANDARD ) if( padType == PAD_ATTRIB_STANDARD )
// actually this is a thru-hole pad // actually this is a thru-hole pad
pad->SetLayerSet( LSET::AllCuMask() | LSET( 2, B_Mask, F_Mask ) ); pad->SetLayerSet( LSET::AllCuMask() | LSET( 2, B_Mask, F_Mask ) );
if( width == 0 || height == 0 )
THROW_IO_ERROR( wxT( "pad with zero size" ) );
pad->SetPadName( m_name.text ); pad->SetPadName( m_name.text );
if( padShapeName == wxT( "Oval" ) if( padShapeName == wxT( "Oval" )
@ -292,6 +293,8 @@ void PCB_PAD::AddToModule( MODULE* aModule, int aRotation, bool aEncapsulatedPad
RotatePoint( &padpos, aModule->GetOrientation() ); RotatePoint( &padpos, aModule->GetOrientation() );
pad->SetPosition( padpos + aModule->GetPosition() ); pad->SetPosition( padpos + aModule->GetPosition() );
} }
aModule->Pads().PushBack( pad );
} }
@ -323,7 +326,7 @@ void PCB_PAD::AddToBoard()
} }
if( width == 0 || height == 0 ) if( width == 0 || height == 0 )
THROW_IO_ERROR( wxT( "pad or via with zero size" ) ); return;
if( IsCopperLayer( m_KiCadLayer ) ) if( IsCopperLayer( m_KiCadLayer ) )
{ {