Static_cast safety.

This commit is contained in:
Jeff Young
2025-07-03 19:37:29 -06:00
parent 54cfb62597
commit 6f7023116d
+13 -11
View File
@@ -2120,12 +2120,8 @@ int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent )
{
const PCB_SELECTION selection = m_toolMgr->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
if( selection.Empty() )
{
m_toolMgr->RunAction<CLIENT_SELECTION_FILTER>( ACTIONS::selectionCursor,
NeighboringSegmentFilter );
}
m_toolMgr->RunAction<CLIENT_SELECTION_FILTER>( ACTIONS::selectionCursor, NeighboringSegmentFilter );
if( selection.Empty() || !selection.Front()->IsBOARD_ITEM() )
return 0;
@@ -2249,16 +2245,22 @@ int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent )
}
else
{
for ( const EDA_ITEM* bitem : selectedItems )
for( const EDA_ITEM* selItem : selectedItems )
{
PNS::ITEM* pitem = m_router->GetWorld()->FindItemByParent( static_cast<const BOARD_ITEM*>( bitem ) );
if( !pitem )
if( !selItem->IsBOARD_ITEM() )
continue;
if( pitem->OfKind( PNS::ITEM::SEGMENT_T ) || pitem->OfKind( PNS::ITEM::VIA_T ) || pitem->OfKind( PNS::ITEM::ARC_T ) )
const BOARD_ITEM* boardItem = static_cast<const BOARD_ITEM*>( selItem );
PNS::ITEM* pnsItem = m_router->GetWorld()->FindItemByParent( boardItem );
if( !pnsItem )
continue;
if( pnsItem->OfKind( PNS::ITEM::SEGMENT_T )
|| pnsItem->OfKind( PNS::ITEM::VIA_T )
|| pnsItem->OfKind( PNS::ITEM::ARC_T ) )
{
itemsToDrag.Add( pitem );
itemsToDrag.Add( pnsItem );
}
}
}