CONNECTIVITY_DATA::IsConnectedOnLayer(): fix crash in some cases.

Fix crash when a zone do not have filled areas on a given layer.
This commit is contained in:
jean-pierre charras 2022-03-12 19:00:59 +01:00
parent 5ef6e97a9e
commit 7fb4a2c0a5
1 changed files with 10 additions and 6 deletions

View File

@ -462,14 +462,18 @@ bool CONNECTIVITY_DATA::IsConnectedOnLayer( const BOARD_CONNECTED_ITEM *aItem, i
else if( CN_ZONE_LAYER* zoneLayer = dynamic_cast<CN_ZONE_LAYER*>( connected ) )
{
ZONE* zone = static_cast<ZONE*>( zoneLayer->Parent() );
int idx = zoneLayer->SubpolyIndex();
const SHAPE_LINE_CHAIN& island = zone->GetFill( layer )->COutline( idx );
SHAPE_CIRCLE flashing( via->GetCenter(), via->GetWidth() / 2 );
for( const VECTOR2I& pt : island.CPoints() )
if( zone->GetFill( layer )->OutlineCount() )
{
if( !flashing.SHAPE::Collide( pt ) )
return true;
int idx = zoneLayer->SubpolyIndex();
const SHAPE_LINE_CHAIN& island = zone->GetFill( layer )->COutline( idx );
SHAPE_CIRCLE flashing( via->GetCenter(), via->GetWidth() / 2 );
for( const VECTOR2I& pt : island.CPoints() )
{
if( !flashing.SHAPE::Collide( pt ) )
return true;
}
}
// If the entire island is inside the via's flashing then the via won't