diff --git a/src/SMDS/SMDS_Mesh.cxx b/src/SMDS/SMDS_Mesh.cxx index a50532de6..d6235a3b7 100644 --- a/src/SMDS/SMDS_Mesh.cxx +++ b/src/SMDS/SMDS_Mesh.cxx @@ -1782,10 +1782,11 @@ const SMDS_MeshFace* SMDS_Mesh::FindFace (const std::vectormore()) { const SMDS_MeshElement* f = itF->next(); if ( f->NbNodes() == nodes.size() ) { - for ( int i = 1; i < nodes.size(); ++ i ) + for ( int i = 1; f && i < nodes.size(); ++ i ) if ( f->GetNodeIndex( nodes[ i ]) < 0 ) - return NULL; - return static_cast (f); + f = 0; + if ( f ) + return static_cast (f); } } }