Salome HOME
[bos #29947] [CEA 29944] SIGSEGV using filet
[modules/shaper.git] / src / GeomAPI / GeomAPI_Wire.cpp
index c1124a353d5fc2b9f30e2ee6c4402a7882ebc665..15a9e38ff5ac189264562e33384cbf4794574a09 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2019  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2021  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -93,6 +93,8 @@ bool GeomAPI_Wire::isRectangle(std::list<GeomPointPtr>& thePoints) const
     const TopoDS_Edge& anEdge = anExp.Current();
     double aT1, aT2;
     Handle(Geom_Curve) aC3D = BRep_Tool::Curve(anEdge, aT1, aT2);
+    if (aC3D.IsNull())
+      continue;
     while (aC3D->IsKind(aTrimmedCurveType))
       aC3D = Handle(Geom_TrimmedCurve)::DownCast(aC3D)->BasisCurve();
     if (!aC3D.IsNull() && aC3D->IsKind(aLineType)) {
@@ -119,7 +121,7 @@ bool GeomAPI_Wire::isRectangle(std::list<GeomPointPtr>& thePoints) const
     else
       return false;
   }
-  return true;
+  return thePoints.size() == 4;
 }
 
 //==================================================================================================