Salome HOME
[bos #37951][EDF 25230] SIGSEGV with MakeVertexInsideFace. Added check for an uniniti... kleontev/37951_SIGSEGV_MakeVertexInsideFace V9_12_0b1 9/head
authorKonstantin Leontev <Konstantin.LEONTEV@opencascade.com>
Mon, 16 Oct 2023 15:08:16 +0000 (16:08 +0100)
committerKonstantin Leontev <Konstantin.LEONTEV@opencascade.com>
Mon, 16 Oct 2023 15:12:16 +0000 (16:12 +0100)
src/GEOMAlgo/GEOMAlgo_AlgoTools.cxx

index 505ec6a8f994c3c7cc7ce834b22f34360c7e6ac0..511de81ac96ee2a30a0651075a171dd8a99c5035 100644 (file)
@@ -1292,6 +1292,13 @@ gp_Pnt GetMidPnt2d(const TopoDS_Face&     theFace,
       const TopoDS_Edge& anEdge = aWexp.Current();
       if (!aUsedEmap.Add(anEdge)) continue;
       BRepAdaptor_Curve2d aBAcurve2d (anEdge, theFace);
+      // Initialization of curve could fail in constructor,
+      // so we need to check if we actually have a curve here.
+      if (!aBAcurve2d.Curve())
+      {
+        continue;
+      }
+
       Standard_Real aDelta = (aBAcurve2d.LastParameter() - aBAcurve2d.FirstParameter())/aNbSamples;
       for (Standard_Integer ii = 0; ii < aNbSamples; ii++)
       {