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,17 +1141,20 @@ 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) )
{ {
bool enable = !( *( mod->Pads().begin() ) )->GetLocalRatsnestVisible(); if( mod->PadsList() )
for( auto modpad : mod->Pads() )
{ {
modpad->SetLocalRatsnestVisible( enable ); bool enable = !( *( mod->Pads().begin() ) )->GetLocalRatsnestVisible();
for( D_PAD* modpad : mod->Pads() )
{
modpad->SetLocalRatsnestVisible( enable );
}
} }
} }
} }