From: eap Date: Mon, 15 Feb 2010 07:11:44 +0000 (+0000) Subject: protect IndexToShape() from Standard_OutOfRange exception X-Git-Tag: V5_1_4a1~86 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3d1a536674bd824b34c05e500638c22542bfa65f;p=modules%2Fsmesh.git protect IndexToShape() from Standard_OutOfRange exception --- 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; } //=======================================================================