// get surface elem is on
if ( aShapeId != helper.GetSubShapeID() ) {
surface.Nullify();
- TopoDS_Shape shape = aMesh->IndexToShape( aShapeId );
+ TopoDS_Shape shape;
+ if ( aShapeId > 0 )
+ shape = aMesh->IndexToShape( aShapeId );
if ( !shape.IsNull() && shape.ShapeType() == TopAbs_FACE ) {
TopoDS_Face face = TopoDS::Face( shape );
surface = BRep_Tool::Surface( face );
int aShapeId = FindShape( elem );
if ( aShapeId != helper.GetSubShapeID() ) {
surface.Nullify();
- TopoDS_Shape shape = aMesh->IndexToShape( aShapeId );
+ TopoDS_Shape shape;
+ if ( aShapeId > 0 )
+ shape = aMesh->IndexToShape( aShapeId );
if ( !shape.IsNull() && shape.ShapeType() == TopAbs_FACE ) {
TopoDS_Face face = TopoDS::Face( shape );
surface = BRep_Tool::Surface( face );