Salome HOME
23594: EDF 17213 : crash of salome when loading SMESH or dumping the study
[modules/smesh.git] / src / SMESHUtils / SMESH_Offset.cxx
index 564a09f69d598112ead34121ae574f0edfbfd9f7..faefc439db2bb5716f2d4c571077b655d59a7cb7 100644 (file)
@@ -2656,6 +2656,11 @@ SMDS_Mesh* SMESH_MeshAlgos::MakeOffset( SMDS_ElemIteratorPtr theFaceIt,
                                         TEPairVec&           theNew2OldFaces,
                                         TNPairVec&           theNew2OldNodes)
 {
+  if ( theSrcMesh.GetMeshInfo().NbFaces( ORDER_QUADRATIC ) > 0 )
+    throw SALOME_Exception( "Offset of quadratic mesh not supported" );
+  if ( theSrcMesh.GetMeshInfo().NbFaces() > theSrcMesh.GetMeshInfo().NbTriangles() )
+    throw SALOME_Exception( "Offset of non-triangular mesh not supported" );
+
   SMDS_Mesh* newMesh = new SMDS_Mesh;
   theNew2OldFaces.clear();
   theNew2OldNodes.clear();
@@ -2663,11 +2668,6 @@ SMDS_Mesh* SMESH_MeshAlgos::MakeOffset( SMDS_ElemIteratorPtr theFaceIt,
     ( std::make_pair(( const SMDS_MeshElement*) 0,
                      ( const SMDS_MeshElement*) 0)); // to have index == face->GetID()
 
-  if ( theSrcMesh.GetMeshInfo().NbFaces( ORDER_QUADRATIC ) > 0 )
-    throw SALOME_Exception( "Offset of quadratic mesh not supported" );
-  if ( theSrcMesh.GetMeshInfo().NbFaces() > theSrcMesh.GetMeshInfo().NbTriangles() )
-    throw SALOME_Exception( "Offset of non-triangular mesh not supported" );
-
   // copy input faces to the newMesh keeping IDs of nodes
 
   double minNodeDist = 1e100;