diff --git a/eeschema/connection_graph.cpp b/eeschema/connection_graph.cpp index d8f1088d71..9c28d64592 100644 --- a/eeschema/connection_graph.cpp +++ b/eeschema/connection_graph.cpp @@ -290,13 +290,12 @@ wxString CONNECTION_SUBGRAPH::driverName( SCH_ITEM* aItem ) const case SCH_LABEL_T: case SCH_GLOBAL_LABEL_T: case SCH_HIER_LABEL_T: - case SCH_SHEET_PIN_T: - { return EscapeString( static_cast( aItem )->GetShownText( &m_sheet ), CTX_NETNAME ); - break; - } - + case SCH_SHEET_PIN_T: + // Sheet pins need to use their parent sheet as their starting sheet or they will + // resolve variables on the current sheet first + return EscapeString( static_cast( aItem )->GetShownText(), CTX_NETNAME ); default: wxFAIL_MSG( wxS( "Unhandled item type in GetNameForDriver" ) ); break;