From 8760519a8719a4d0a281bb96a9d500c2799e14a4 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Sun, 14 Apr 2024 13:47:29 -0700 Subject: [PATCH] Ensure that we are not calculating self-collision Ratsnest may have connections from a zone to two different items. This should be avoided as we never want to draw the ratsnest line with the same element as start and finish Fixes https://gitlab.com/kicad/code/kicad/-/issues/17763 --- pcbnew/ratsnest/ratsnest_data.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pcbnew/ratsnest/ratsnest_data.cpp b/pcbnew/ratsnest/ratsnest_data.cpp index 9133734da5..93d0bd6274 100644 --- a/pcbnew/ratsnest/ratsnest_data.cpp +++ b/pcbnew/ratsnest/ratsnest_data.cpp @@ -388,7 +388,10 @@ void RN_NET::OptimizeRNEdges() { CN_ZONE_LAYER* zoneLayerB = dynamic_cast( itemB ); - if( zoneLayerB && zoneLayerB->Layer() == zoneLayerA->Layer() ) + if( !zoneLayerB || zoneLayerB == zoneLayerA ) + continue; + + if( zoneLayerB->Layer() == zoneLayerA->Layer() ) { // Process the first matching layer. We don't really care if it's // the "best" layer or not, as anything will be better than the