Pin 0-sized pads at 1um rather than throwing them out.

(See bug report for more commentary.)

Fixes https://gitlab.com/kicad/code/kicad/issues/12617

(cherry picked from commit 46a41e2e34)
This commit is contained in:
Jeff Young 2022-10-13 14:47:17 +01:00
parent 5bcd0a5828
commit a65fc7f82a
1 changed files with 7 additions and 3 deletions

View File

@ -4500,10 +4500,14 @@ PAD* PCB_PARSER::parsePAD( FOOTPRINT* aParent )
if( !pad->GetRemoveUnconnected() )
pad->SetKeepTopBottom( true );
// Zero-sized pads are not really selectable and likely cause crashes.
// They are not supported by KiCad and are removed on loading
// Zero-sized pads are likely algorithmically unsafe.
if( pad->GetSizeX() <= 0 || pad->GetSizeY() <= 0 )
return nullptr;
{
pad->SetSize( wxSize( IU_PER_MM * 0.001, IU_PER_MM * 0.001 ) );
wxLogWarning( wxT( "Invalid zero-sized pad pinned to 1µm in\nfile: %s\nline: %d\noffset: %d" ),
CurSource(), CurLineNumber(), CurOffset() );
}
return pad.release();
}