diff --git a/src/SMESHDS/SMESHDS_Mesh.cxx b/src/SMESHDS/SMESHDS_Mesh.cxx index 34118b829..c4479f35b 100644 --- a/src/SMESHDS/SMESHDS_Mesh.cxx +++ b/src/SMESHDS/SMESHDS_Mesh.cxx @@ -34,8 +34,10 @@ #include "SMDS_SpacePosition.hxx" #include "SMESHDS_GroupOnGeom.hxx" -#include +#include +#include #include +#include #include #include "utilities.h" @@ -1235,7 +1237,15 @@ int SMESHDS_Mesh::AddCompoundSubmesh(const TopoDS_Shape& S, //======================================================================= const TopoDS_Shape& SMESHDS_Mesh::IndexToShape(int ShapeIndex) const { - return myIndexToShape.FindKey(ShapeIndex); + try + { + return myIndexToShape.FindKey(ShapeIndex); + } + catch ( Standard_OutOfRange ) + { + } + static TopoDS_Shape nullShape; + return nullShape; } //=======================================================================