From: jfa Date: Wed, 6 Dec 2006 11:25:18 +0000 (+0000) Subject: PAL14122: EDF 307: GEOM: GetInPlace --> COMM_FAILURE. Prevent crash. X-Git-Tag: V3_2_4pre1~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3b3e7ac44c6f28c03058174f08f86d80c943c26e;p=modules%2Fgeom.git PAL14122: EDF 307: GEOM: GetInPlace --> COMM_FAILURE. Prevent crash. --- diff --git a/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx b/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx index 48f6dd2fc..6262b41fa 100644 --- a/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx @@ -2268,6 +2268,10 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlace TColStd_ListOfInteger aModifiedList; isFound = GetInPlaceOfCompound(aWhereFunction, aWhat, aModifiedList); if (isFound) { + if (aModifiedList.Extent() < 1) { + SetErrorCode("Error: Empty modifications history for all sub-shapes of the sought shape."); + return NULL; + } aModifiedArray = new TColStd_HArray1OfInteger (1, aModifiedList.Extent()); TColStd_ListIteratorOfListOfInteger anIterModif (aModifiedList); for (Standard_Integer imod = 1; anIterModif.More(); anIterModif.Next(), imod++) { @@ -2284,6 +2288,10 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlace //Add a new object Handle(GEOM_Object) aResult = GetEngine()->AddSubShape(theShapeWhere, aModifiedArray); + if (aResult.IsNull()) { + SetErrorCode("Error in algorithm: result found, but cannot be returned."); + return NULL; + } if (aModifiedArray->Length() > 1) { //Set a GROUP type