diff --git a/pcbnew/tools/pcb_editor_control.cpp b/pcbnew/tools/pcb_editor_control.cpp index a66e509586..d409bb8ead 100644 --- a/pcbnew/tools/pcb_editor_control.cpp +++ b/pcbnew/tools/pcb_editor_control.cpp @@ -1141,17 +1141,20 @@ static bool showLocalRatsnest( TOOL_MANAGER* aToolMgr, BOARD* aBoard, const VECT { for( auto item : selection ) { - if( auto pad = dyn_cast(item) ) + if( D_PAD* pad = dyn_cast(item) ) { pad->SetLocalRatsnestVisible( !pad->GetLocalRatsnestVisible() ); } - else if( auto mod = dyn_cast(item) ) + else if( MODULE* mod = dyn_cast(item) ) { - bool enable = !( *( mod->Pads().begin() ) )->GetLocalRatsnestVisible(); - - for( auto modpad : mod->Pads() ) + if( mod->PadsList() ) { - modpad->SetLocalRatsnestVisible( enable ); + bool enable = !( *( mod->Pads().begin() ) )->GetLocalRatsnestVisible(); + + for( D_PAD* modpad : mod->Pads() ) + { + modpad->SetLocalRatsnestVisible( enable ); + } } } }