From 54db132ba15eba64f6ea4a6f2b5644313e56ff1c Mon Sep 17 00:00:00 2001 From: eap Date: Tue, 10 Mar 2020 17:11:19 +0300 Subject: [PATCH] Fix SIGSEGV on imps_09/K0 Not sure about "continue;" --- src/SMESHUtils/SMESH_Slot.cxx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/SMESHUtils/SMESH_Slot.cxx b/src/SMESHUtils/SMESH_Slot.cxx index 00521c0b5..00c7e6ed2 100644 --- a/src/SMESHUtils/SMESH_Slot.cxx +++ b/src/SMESHUtils/SMESH_Slot.cxx @@ -836,20 +836,22 @@ SMESH_MeshAlgos::MakeSlot( SMDS_ElemIteratorPtr theSegmentIt, // 2) double minCutDist = theWidth; gp_XYZ projection, closestProj; - int iCut; - for ( size_t iC = 0; iC < closeSeg[iP]->myCuts.size(); ++iC ) + int iCut = -1; + for ( size_t iC2 = 0; iC2 < closeSeg[iP]->myCuts.size(); ++iC2 ) { - double cutDist = closeSeg[iP]->myCuts[iC].SquareDistance( intPnt[iP].myNode, + double cutDist = closeSeg[iP]->myCuts[iC2].SquareDistance( intPnt[iP].myNode, projection ); if ( cutDist < minCutDist ) { closestProj = projection; minCutDist = cutDist; - iCut = iC; + iCut = iC2; + if ( minCutDist < tol * tol ) + break; } - if ( minCutDist < tol * tol ) - break; } + if ( iCut < 0 ) + continue; // ??? double d1 = SMESH_MeshAlgos::GetDistance( neighborSeg->myEdge, closeSeg[iP]->myCuts[iCut][0].myNode ); double d2 = SMESH_MeshAlgos::GetDistance( neighborSeg->myEdge,