]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
lot 15:: protection against corrupted polylines/objects
authorisn <isn@opencascade.com>
Thu, 7 Feb 2019 11:41:19 +0000 (14:41 +0300)
committerisn <isn@opencascade.com>
Thu, 7 Feb 2019 11:41:19 +0000 (14:41 +0300)
src/HYDROData/HYDROData_CompleteCalcCase.cxx

index 01b83a90b138d52528362f228609a7fd9fc070e5..4814cf27e2781210da27c6892dcb4121e016d20a 100644 (file)
@@ -42,7 +42,12 @@ static void GetModifToOrigHistory(BOPAlgo_Builder& theAlgo, TopTools_IndexedData
   TopTools_IndexedMapOfShape argsAllSh;
   TopTools_ListOfShape::Iterator it(args);
   for (;it.More();it.Next())
+  {
+    const TopoDS_Shape& aSh = it.Value();
+    if (aSh.IsNull())
+      continue;
     TopExp::MapShapes(it.Value(), argsAllSh);
+  }
   for (int i=1;i<=argsAllSh.Extent();i++)
   {
     const TopoDS_Shape& arg_sh = argsAllSh(i);
@@ -127,10 +132,13 @@ bool HYDROData_CompleteCalcCase::AddObjects( const Handle(HYDROData_Document)& d
     if (!aPolyXY.IsNull())
     {
       TopoDS_Shape aSh = aPolyXY->GetShape();
-      newShapes.push_back(aSh);
-      anAlgo.AddArgument(aSh);
-      QStringList aLS(aPolyXY->GetName());
-      aShToRefObjects.Bind(aSh, aLS);
+      if (!aSh.IsNull())
+      {
+        newShapes.push_back(aSh);
+        anAlgo.AddArgument(aSh);
+        QStringList aLS(aPolyXY->GetName());
+        aShToRefObjects.Bind(aSh, aLS);
+      }
     }
     else 
     {
@@ -148,10 +156,13 @@ bool HYDROData_CompleteCalcCase::AddObjects( const Handle(HYDROData_Document)& d
           newshapesGroups.push_back(aGroup);
         }
         //
-        newShapes.push_back(aSh);
-        anAlgo.AddArgument(aSh);
-        QStringList aLS(anObj->GetName());
-        aShToRefObjects.Bind(aSh, aLS);
+        if (!aSh.IsNull())
+        {
+          newShapes.push_back(aSh);
+          anAlgo.AddArgument(aSh);
+          QStringList aLS(anObj->GetName());
+          aShToRefObjects.Bind(aSh, aLS);
+        }
       }
     }
   }
@@ -247,7 +258,7 @@ bool HYDROData_CompleteCalcCase::AddObjects( const Handle(HYDROData_Document)& d
       NREGV.push_back(vect);
     }
   }
-  
+
   //iter through already existing zone
   //substract new zones (NREGV) from old zones
   for ( int i = 1; i <= aRegions.Size(); i++ )