From 3b3e7ac44c6f28c03058174f08f86d80c943c26e Mon Sep 17 00:00:00 2001 From: jfa Date: Wed, 6 Dec 2006 11:25:18 +0000 Subject: [PATCH] PAL14122: EDF 307: GEOM: GetInPlace --> COMM_FAILURE. Prevent crash. --- src/GEOMImpl/GEOMImpl_IShapesOperations.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) 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 -- 2.39.2