From 6ba63abdcb5832a1773cb33cf67d6b34aee4139d Mon Sep 17 00:00:00 2001 From: isn Date: Thu, 7 Feb 2019 14:41:19 +0300 Subject: [PATCH] lot 15:: protection against corrupted polylines/objects --- src/HYDROData/HYDROData_CompleteCalcCase.cxx | 29 ++++++++++++++------ 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/src/HYDROData/HYDROData_CompleteCalcCase.cxx b/src/HYDROData/HYDROData_CompleteCalcCase.cxx index 01b83a90..4814cf27 100644 --- a/src/HYDROData/HYDROData_CompleteCalcCase.cxx +++ b/src/HYDROData/HYDROData_CompleteCalcCase.cxx @@ -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++ ) -- 2.39.2