From: azv Date: Tue, 13 Jan 2015 14:44:38 +0000 (+0300) Subject: 0025578: SIGSEGV in BRepSweep_Rotation in case of singularities X-Git-Tag: V6_9_0_beta~169 X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=79186c39b3bf15422a0f3865edf91d7b5296b60a;p=occt-copy.git 0025578: SIGSEGV in BRepSweep_Rotation in case of singularities Eliminating degenerated edges --- diff --git a/src/BRepSweep/BRepSweep_Rotation.cxx b/src/BRepSweep/BRepSweep_Rotation.cxx index b0d01d3d42..52ad5204ec 100644 --- a/src/BRepSweep/BRepSweep_Rotation.cxx +++ b/src/BRepSweep/BRepSweep_Rotation.cxx @@ -822,7 +822,17 @@ Standard_Boolean BRepSweep_Rotation::HasShape { if(aDirS.Type()==TopAbs_EDGE&& aGenS.ShapeType()==TopAbs_EDGE){ - return !IsInvariant(aGenS); + // Verify that the edge has entrails + const TopoDS_Edge& anEdge = TopoDS::Edge(aGenS); + Standard_Boolean hasGeom = !BRep_Tool::Degenerated(anEdge); + if (hasGeom) + { // The edge is not degenerated. Check if it has no curve + Standard_Real aPFirst, aPLast; + TopLoc_Location aLoc; + Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aLoc, aPFirst, aPLast); + hasGeom = !aCurve.IsNull(); + } + return hasGeom && !IsInvariant(aGenS); } else{ return Standard_True; @@ -843,8 +853,7 @@ Standard_Boolean BRepSweep_Rotation::IsInvariant Standard_Real First,Last; Handle(Geom_Curve) C = BRep_Tool::Curve(TopoDS::Edge(aGenS),Loc,First,Last); - Handle(Standard_Type) TheType = C->DynamicType(); - if ( TheType == STANDARD_TYPE(Geom_Line)) { + if (C.IsNull() || C->DynamicType() == STANDARD_TYPE(Geom_Line)) { TopoDS_Vertex V1, V2; TopExp::Vertices(TopoDS::Edge(aGenS), V1, V2); return ( IsInvariant(V1) && IsInvariant(V2));