Fix crash bug when selecting marker.

This commit is contained in:
Jeff Young 2022-04-15 13:40:19 +01:00
parent 847fa7f2c4
commit 110663d214
1 changed files with 16 additions and 8 deletions

View File

@ -399,18 +399,26 @@ void DIALOG_DRC::OnDRCItemSelected( wxDataViewEvent& aEvent )
if( rc_item->GetErrorCode() == DRCE_DIFF_PAIR_UNCOUPLED_LENGTH_TOO_LONG ) if( rc_item->GetErrorCode() == DRCE_DIFF_PAIR_UNCOUPLED_LENGTH_TOO_LONG )
{ {
PCB_TRACK* track = dynamic_cast<PCB_TRACK*>( item ); PCB_TRACK* track = dynamic_cast<PCB_TRACK*>( item );
int net = track->GetNetCode();
std::vector<BOARD_ITEM*> segs;
for( const KIID& id : rc_item->GetIDs() ) if( track )
{ {
PCB_TRACK* candidate = dynamic_cast<PCB_TRACK*>( board->GetItem( id ) ); int net = track->GetNetCode();
std::vector<BOARD_ITEM*> segs;
if( candidate && candidate->GetNetCode() == net ) for( const KIID& id : rc_item->GetIDs() )
segs.push_back( candidate ); {
PCB_TRACK* candidate = dynamic_cast<PCB_TRACK*>( board->GetItem( id ) );
if( candidate && candidate->GetNetCode() == net )
segs.push_back( candidate );
}
m_frame->FocusOnItems( segs, principalLayer );
}
else
{
m_frame->FocusOnItem( item, principalLayer );
} }
m_frame->FocusOnItems( segs, principalLayer );
} }
else if( m_centerMarkerOnIdle ) else if( m_centerMarkerOnIdle )
{ {