From: adv Date: Fri, 29 Nov 2013 10:45:29 +0000 (+0000) Subject: Protection from crash. X-Git-Tag: BR_hydro_v_0_4~130 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=cac46feaa40242b3cac01b4c813efdeca4b2eed5;p=modules%2Fhydro.git Protection from crash. --- diff --git a/src/HYDROData/HYDROData_SplitToZonesTool.cxx b/src/HYDROData/HYDROData_SplitToZonesTool.cxx index 0990ef4c..9b279724 100644 --- a/src/HYDROData/HYDROData_SplitToZonesTool.cxx +++ b/src/HYDROData/HYDROData_SplitToZonesTool.cxx @@ -46,23 +46,26 @@ HYDROData_SplitToZonesTool::SplitToZones( const HYDROData_SequenceOfObjects& the { Handle(HYDROData_Object) aGeomObj = Handle(HYDROData_Object)::DownCast( theObjectList.Value( anIndex ) ); - if( !aGeomObj.IsNull() ) - { - TopoDS_Shape aShape = aGeomObj->GetTopShape(); - if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_COMPOUND ) { - // Create split data for each face contained in the compound - TopExp_Explorer anExp( aShape, TopAbs_FACE ); - for ( ; anExp.More(); anExp.Next() ) { - TopoDS_Face aFace = TopoDS::Face( anExp.Current() ); - if ( !aFace.IsNull() ) { - SplitData aSplitData( aFace, aGeomObj->GetName() ); - anInputSplitDataList.append( aSplitData ); - } + if( aGeomObj.IsNull() ) + continue; + + TopoDS_Shape aShape = aGeomObj->GetTopShape(); + if ( aShape.IsNull() ) + continue; + + if ( aShape.ShapeType() == TopAbs_COMPOUND ) { + // Create split data for each face contained in the compound + TopExp_Explorer anExp( aShape, TopAbs_FACE ); + for ( ; anExp.More(); anExp.Next() ) { + TopoDS_Face aFace = TopoDS::Face( anExp.Current() ); + if ( !aFace.IsNull() ) { + SplitData aSplitData( aFace, aGeomObj->GetName() ); + anInputSplitDataList.append( aSplitData ); } - } else { - SplitData aSplitData( aShape, aGeomObj->GetName() ); - anInputSplitDataList.append( aSplitData ); } + } else { + SplitData aSplitData( aShape, aGeomObj->GetName() ); + anInputSplitDataList.append( aSplitData ); } }