Salome HOME
0020431: EDF 1020 SMESH : Radial Mesh of a cylinder
[modules/smesh.git] / src / SMDS / SMDS_MeshElement.cxx
index 646f92d10cf6de7901a1d3c1dabb7f067c8d6e9a..a24cbff94b6512aeed6dc066cbb171e3f0c5707d 100644 (file)
@@ -202,12 +202,13 @@ bool SMDS_MeshElement::IsValidIndex(const int ind) const
 
 const SMDS_MeshNode* SMDS_MeshElement::GetNode(const int ind) const
 {
-  SMDS_ElemIteratorPtr it = nodesIterator();
-  int i = 0, index = WrappedIndex( ind );
-  while ( index != i++ )
-    it->next();
-  if ( it->more() )
-    return static_cast<const SMDS_MeshNode*> (it->next());
+  if ( ind >= 0 ) {
+    SMDS_ElemIteratorPtr it = nodesIterator();
+    for ( int i = 0; i < ind; ++i )
+      it->next();
+    if ( it->more() )
+      return static_cast<const SMDS_MeshNode*> (it->next());
+  }
   return 0;
 }