From 6f7475dcd39cfb19d97041622d4c3c5840f64104 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Tue, 21 May 2019 19:29:29 -0700 Subject: [PATCH] pcbnew: Prevent no-connects from driving clusters The no-connect net (0) should never drive the net of a cluster. Otherwise, tracks connecting between unconnected pads and connected pads can acquire net 0 incorrectly. --- pcbnew/connectivity/connectivity_items.cpp | 5 ++++- pcbnew/connectivity/connectivity_items.h | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pcbnew/connectivity/connectivity_items.cpp b/pcbnew/connectivity/connectivity_items.cpp index a39d2adfd6..6d1cd7c0b5 100644 --- a/pcbnew/connectivity/connectivity_items.cpp +++ b/pcbnew/connectivity/connectivity_items.cpp @@ -330,7 +330,10 @@ void CN_CLUSTER::Add( CN_ITEM* item ) { m_items.push_back( item ); - if( m_originNet < 0 ) + if( item->Net() <= 0 ) + return; + + if( m_originNet <= 0 ) { m_originNet = item->Net(); } diff --git a/pcbnew/connectivity/connectivity_items.h b/pcbnew/connectivity/connectivity_items.h index b8d63db301..8fabdaaa91 100644 --- a/pcbnew/connectivity/connectivity_items.h +++ b/pcbnew/connectivity/connectivity_items.h @@ -482,7 +482,7 @@ public: bool HasValidNet() const { - return m_originNet >= 0; + return m_originNet > 0; } int OriginNet() const @@ -503,7 +503,7 @@ public: bool HasNet() const { - return m_originNet >= 0; + return m_originNet > 0; } bool IsOrphaned() const