Fix crash when selecting DRC marker (as opposed to one of its children).
This commit is contained in:
parent
e9da8c3a00
commit
18ac4ed842
|
@ -442,19 +442,26 @@ void DIALOG_DRC::OnDRCItemSelected( wxDataViewEvent& aEvent )
|
||||||
}
|
}
|
||||||
else if( rc_item->GetErrorCode() == DRCE_DIFF_PAIR_UNCOUPLED_LENGTH_TOO_LONG )
|
else if( rc_item->GetErrorCode() == DRCE_DIFF_PAIR_UNCOUPLED_LENGTH_TOO_LONG )
|
||||||
{
|
{
|
||||||
BOARD_CONNECTED_ITEM* connectedItem = dynamic_cast<PCB_TRACK*>( item );
|
BOARD_CONNECTED_ITEM* track = dynamic_cast<PCB_TRACK*>( item );
|
||||||
int net = connectedItem ? connectedItem->GetNetCode() : -1;
|
|
||||||
std::vector<BOARD_ITEM*> items;
|
std::vector<BOARD_ITEM*> items;
|
||||||
|
|
||||||
wxASSERT( net > 0 ); // Without a net how can it be a diff-pair?
|
if( track )
|
||||||
|
|
||||||
for( const KIID& id : rc_item->GetIDs() )
|
|
||||||
{
|
{
|
||||||
auto* candidate = dynamic_cast<BOARD_CONNECTED_ITEM*>( board->GetItem( id ) );
|
int net = track->GetNetCode();
|
||||||
wxASSERT( candidate );
|
|
||||||
|
|
||||||
if( candidate && candidate->GetNetCode() == net )
|
wxASSERT( net > 0 ); // Without a net how can it be a diff-pair?
|
||||||
items.push_back( candidate );
|
|
||||||
|
for( const KIID& id : rc_item->GetIDs() )
|
||||||
|
{
|
||||||
|
auto* candidate = dynamic_cast<BOARD_CONNECTED_ITEM*>( board->GetItem( id ) );
|
||||||
|
|
||||||
|
if( candidate && candidate->GetNetCode() == net )
|
||||||
|
items.push_back( candidate );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
items.push_back( item );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_frame->FocusOnItems( items, principalLayer );
|
m_frame->FocusOnItems( items, principalLayer );
|
||||||
|
|
Loading…
Reference in New Issue