From 27a2b840ec6a5e5414fc1fb4db195317a7455998 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Fri, 31 May 2019 21:55:43 -0400 Subject: [PATCH] Eeschema: Fix multiple net label ERC after sorting changes Fixes: lp:1831003 * https://bugs.launchpad.net/kicad/+bug/1831003 --- eeschema/connection_graph.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/eeschema/connection_graph.cpp b/eeschema/connection_graph.cpp index b60bdb8219..601b562b93 100644 --- a/eeschema/connection_graph.cpp +++ b/eeschema/connection_graph.cpp @@ -138,12 +138,14 @@ bool CONNECTION_SUBGRAPH::ResolveDrivers( bool aCreateMarkers ) { // First check if all the candidates are actually the same bool same = true; - auto first = GetNameForDriver( candidates[0] ); + wxString first = GetNameForDriver( candidates[0] ); + SCH_ITEM* second_item = nullptr; for( unsigned i = 1; i < candidates.size(); i++ ) { if( GetNameForDriver( candidates[i] ) != first ) { + second_item = candidates[i]; same = false; break; } @@ -155,18 +157,18 @@ bool CONNECTION_SUBGRAPH::ResolveDrivers( bool aCreateMarkers ) msg.Printf( _( "%s and %s are both attached to the same wires. " "%s was picked as the label to use for netlisting." ), candidates[0]->GetSelectMenuText( m_frame->GetUserUnits() ), - candidates[1]->GetSelectMenuText( m_frame->GetUserUnits() ), + second_item->GetSelectMenuText( m_frame->GetUserUnits() ), candidates[0]->Connection( m_sheet )->Name() ); - wxASSERT( candidates[0] != candidates[1] ); + wxASSERT( candidates[0] != second_item ); auto p0 = ( candidates[0]->Type() == SCH_PIN_T ) ? static_cast( candidates[0] )->GetTransformedPosition() : candidates[0]->GetPosition(); - auto p1 = ( candidates[1]->Type() == SCH_PIN_T ) ? - static_cast( candidates[1] )->GetTransformedPosition() : - candidates[1]->GetPosition(); + auto p1 = ( second_item->Type() == SCH_PIN_T ) ? + static_cast( second_item )->GetTransformedPosition() : + second_item->GetPosition(); auto marker = new SCH_MARKER(); marker->SetTimeStamp( GetNewTimeStamp() );