Fix PCBnew crash when show local ratsnest and selecting a footprint with no pads

From master, commit e3c3dae
This commit is contained in:
jean-pierre charras 2020-06-01 09:22:29 +02:00
parent 2395c6fdaa
commit 542f713678
1 changed files with 9 additions and 6 deletions

View File

@ -1141,21 +1141,24 @@ static bool showLocalRatsnest( TOOL_MANAGER* aToolMgr, BOARD* aBoard, const VECT
{ {
for( auto item : selection ) for( auto item : selection )
{ {
if( auto pad = dyn_cast<D_PAD*>(item) ) if( D_PAD* pad = dyn_cast<D_PAD*>(item) )
{ {
pad->SetLocalRatsnestVisible( !pad->GetLocalRatsnestVisible() ); pad->SetLocalRatsnestVisible( !pad->GetLocalRatsnestVisible() );
} }
else if( auto mod = dyn_cast<MODULE*>(item) ) else if( MODULE* mod = dyn_cast<MODULE*>(item) )
{
if( mod->PadsList() )
{ {
bool enable = !( *( mod->Pads().begin() ) )->GetLocalRatsnestVisible(); bool enable = !( *( mod->Pads().begin() ) )->GetLocalRatsnestVisible();
for( auto modpad : mod->Pads() ) for( D_PAD* modpad : mod->Pads() )
{ {
modpad->SetLocalRatsnestVisible( enable ); modpad->SetLocalRatsnestVisible( enable );
} }
} }
} }
} }
}
aToolMgr->GetView()->MarkTargetDirty( KIGFX::TARGET_OVERLAY ); aToolMgr->GetView()->MarkTargetDirty( KIGFX::TARGET_OVERLAY );