pcbnew: MODULEs are not BOARD_CONNECTED_ITEMS

Handling ratsnest requires first checking for modules, handling their
pads and then checking that the remaining elements derive from
BOARD_CONNECTED_ITEM

Fixes https://gitlab.com/kicad/code/kicad/issues/5131
This commit is contained in:
Seth Hillbrand 2020-08-10 10:59:23 -07:00
parent 23a5b0ca5f
commit 211cbadc24
1 changed files with 4 additions and 8 deletions

View File

@ -500,12 +500,7 @@ void PCB_INSPECTION_TOOL::calculateSelectionRatsnest()
for( EDA_ITEM* item : selection )
{
BOARD_CONNECTED_ITEM* boardItem = dyn_cast<BOARD_CONNECTED_ITEM*>( item );
if( !boardItem )
continue;
if( boardItem->Type() == PCB_MODULE_T )
if( item->Type() == PCB_MODULE_T )
{
for( auto pad : static_cast<MODULE*>( item )->Pads() )
{
@ -513,8 +508,9 @@ void PCB_INSPECTION_TOOL::calculateSelectionRatsnest()
items.push_back( pad );
}
}
else if( boardItem->GetLocalRatsnestVisible() || displayOptions().m_ShowModuleRatsnest )
else if( BOARD_CONNECTED_ITEM* boardItem = dyn_cast<BOARD_CONNECTED_ITEM*>( item ) )
{
if( boardItem->GetLocalRatsnestVisible() || displayOptions().m_ShowModuleRatsnest )
items.push_back( boardItem );
}
}