]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
PAL14122: EDF 307: GEOM: GetInPlace --> COMM_FAILURE. Prevent crash.
authorjfa <jfa@opencascade.com>
Wed, 6 Dec 2006 11:25:18 +0000 (11:25 +0000)
committerjfa <jfa@opencascade.com>
Wed, 6 Dec 2006 11:25:18 +0000 (11:25 +0000)
src/GEOMImpl/GEOMImpl_IShapesOperations.cxx

index 48f6dd2fc39f5bd96233a90ee5eba9147827475a..6262b41fa6fc84df4836da2f35000b76eb941b88 100644 (file)
@@ -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