← Back to team overview

kicad-developers team mailing list archive

[PATCH] Remove check for undefined behaviour

 

Triangle::NeighborAcross returns a reference, which must refer to a valid
object whose address cannot be 0. Thus, this test is nonsensical.
---
 polygon/poly2tri/sweep/sweep.cc | 16 ----------------
 1 file changed, 16 deletions(-)

diff --git a/polygon/poly2tri/sweep/sweep.cc b/polygon/poly2tri/sweep/sweep.cc
index 095437b..da3de0b 100644
--- a/polygon/poly2tri/sweep/sweep.cc
+++ b/polygon/poly2tri/sweep/sweep.cc
@@ -882,14 +882,6 @@ void Sweep::FlipEdgeEvent( SweepContext& tcx, Point& ep, Point& eq, Triangle* t,
     Triangle& ot = t->NeighborAcross( p );
     Point& op = *ot.OppositePoint( *t, p );
 
-    if( &ot == NULL )
-    {
-        // If we want to integrate the fillEdgeEvent do it here
-        // With current implementation we should never get here
-        // throw new RuntimeException( "[BUG:FIXME] FLIP failed due to missing triangle");
-        assert( 0 );
-    }
-
     if( InScanArea( p, *t->PointCCW( p ), *t->PointCW( p ), op ) )
     {
         // Lets rotate shared edge one vertex CW
@@ -984,14 +976,6 @@ void Sweep::FlipScanEdgeEvent( SweepContext& tcx, Point& ep, Point& eq, Triangle
     Triangle& ot = t.NeighborAcross( p );
     Point& op = *ot.OppositePoint( t, p );
 
-    if( &t.NeighborAcross( p ) == NULL )
-    {
-        // If we want to integrate the fillEdgeEvent do it here
-        // With current implementation we should never get here
-        // throw new RuntimeException( "[BUG:FIXME] FLIP failed due to missing triangle");
-        assert( 0 );
-    }
-
     if( InScanArea( eq, *flip_triangle.PointCCW( eq ), *flip_triangle.PointCW( eq ), op ) )
     {
         // flip with new edge op->eq

Follow ups