diff --git a/pcbnew/dialogs/dialog_drc.cpp b/pcbnew/dialogs/dialog_drc.cpp index 639d4c7bcb..d823d9d4e1 100644 --- a/pcbnew/dialogs/dialog_drc.cpp +++ b/pcbnew/dialogs/dialog_drc.cpp @@ -399,18 +399,26 @@ void DIALOG_DRC::OnDRCItemSelected( wxDataViewEvent& aEvent ) if( rc_item->GetErrorCode() == DRCE_DIFF_PAIR_UNCOUPLED_LENGTH_TOO_LONG ) { PCB_TRACK* track = dynamic_cast( item ); - int net = track->GetNetCode(); - std::vector segs; - for( const KIID& id : rc_item->GetIDs() ) + if( track ) { - PCB_TRACK* candidate = dynamic_cast( board->GetItem( id ) ); + int net = track->GetNetCode(); + std::vector segs; - if( candidate && candidate->GetNetCode() == net ) - segs.push_back( candidate ); + for( const KIID& id : rc_item->GetIDs() ) + { + PCB_TRACK* candidate = dynamic_cast( 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 ) {