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