From 3d1a536674bd824b34c05e500638c22542bfa65f Mon Sep 17 00:00:00 2001 From: eap Date: Mon, 15 Feb 2010 07:11:44 +0000 Subject: [PATCH] protect IndexToShape() from Standard_OutOfRange exception --- src/SMESHDS/SMESHDS_Mesh.cxx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) 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; } //=======================================================================