From 542f713678c6404c3f395163c6ab506de00d2f58 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 1 Jun 2020 09:22:29 +0200 Subject: [PATCH] Fix PCBnew crash when show local ratsnest and selecting a footprint with no pads From master, commit e3c3dae --- pcbnew/tools/pcb_editor_control.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) 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 ); + } } } }