Fix PCBnew crash when show local ratsnest and selecting a footprint with no pads
Fixes #4506 https://gitlab.com/kicad/code/kicad/issues/4506
This commit is contained in:
parent
adb1074597
commit
e3c3dae776
|
@ -315,9 +315,9 @@ int PCB_INSPECTION_TOOL::LocalRatsnestTool( const TOOL_EVENT& aEvent )
|
||||||
if( selection.Empty() )
|
if( selection.Empty() )
|
||||||
{
|
{
|
||||||
// Clear the previous local ratsnest if we click off all items
|
// Clear the previous local ratsnest if we click off all items
|
||||||
for( auto mod : board->Modules() )
|
for( MODULE* mod : board->Modules() )
|
||||||
{
|
{
|
||||||
for( auto pad : mod->Pads() )
|
for( D_PAD* pad : mod->Pads() )
|
||||||
pad->SetLocalRatsnestVisible( opt.m_ShowGlobalRatsnest );
|
pad->SetLocalRatsnestVisible( opt.m_ShowGlobalRatsnest );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -325,11 +325,13 @@ int PCB_INSPECTION_TOOL::LocalRatsnestTool( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
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->Pads().empty() )
|
||||||
{
|
{
|
||||||
bool enable = !( *( mod->Pads().begin() ) )->GetLocalRatsnestVisible();
|
bool enable = !( *( mod->Pads().begin() ) )->GetLocalRatsnestVisible();
|
||||||
|
|
||||||
|
@ -338,6 +340,7 @@ int PCB_INSPECTION_TOOL::LocalRatsnestTool( const TOOL_EVENT& aEvent )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_toolMgr->GetView()->MarkTargetDirty( KIGFX::TARGET_OVERLAY );
|
m_toolMgr->GetView()->MarkTargetDirty( KIGFX::TARGET_OVERLAY );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue