]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Protection from crash.
authoradv <adv@opencascade.com>
Fri, 29 Nov 2013 10:45:29 +0000 (10:45 +0000)
committeradv <adv@opencascade.com>
Fri, 29 Nov 2013 10:45:29 +0000 (10:45 +0000)
src/HYDROData/HYDROData_SplitToZonesTool.cxx

index 0990ef4c1ddfee9d748ebd502834ff7e3c843b93..9b279724a040996e7fa09b21da7cd82861812c62 100644 (file)
@@ -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 );
     }
   }