← Back to team overview

kicad-developers team mailing list archive

[PATCH 3/5] Schematic Cleanup: Move lhs == rhs test to beginning of loop

 

---
 eeschema/sch_screen.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp
index fd9b9b2..182bba7 100644
--- a/eeschema/sch_screen.cpp
+++ b/eeschema/sch_screen.cpp
@@ -446,6 +446,9 @@ bool SCH_SCREEN::SchematicCleanUp()
         {
             restart = false;
 
+            if( testItem == item )
+                continue;
+
             if( lhs_isLine && ( testItem->Type() == SCH_LINE_T ) )
             {
                 SCH_LINE* line = (SCH_LINE*) item;
@@ -459,8 +462,7 @@ bool SCH_SCREEN::SchematicCleanUp()
                     modified = true;
                 }
             }
-            else if ( ( lhs_isJunction
-                      && ( testItem->Type() == SCH_JUNCTION_T ) ) && ( testItem != item ) )
+            else if ( ( lhs_isJunction && ( testItem->Type() == SCH_JUNCTION_T ) ) )
             {
                 if ( testItem->HitTest( item->GetPosition() ) )
                 {

Follow ups

References