]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
Fix problem in DifferenceList() function: when group becomes empty, an invalid compou...
authorvsr <vsr@opencascade.com>
Fri, 22 Apr 2011 14:44:29 +0000 (14:44 +0000)
committervsr <vsr@opencascade.com>
Fri, 22 Apr 2011 14:44:29 +0000 (14:44 +0000)
src/GEOMImpl/GEOMImpl_IGroupOperations.cxx

index cf81ed23c84d85a8e4b2e4748f05b2f233549665..86ed5fbe73b551895cb4e8f8cc451f5a5788e681 100644 (file)
@@ -485,14 +485,20 @@ void GEOMImpl_IGroupOperations::DifferenceList (Handle(GEOM_Object) theGroup,
 
   if (mapIDsToRemove.Extent() > 0) {
     Standard_Integer k = 1, aRemLength = mapIDsToRemove.Extent();
-    Handle(TColStd_HArray1OfInteger) aNewSeq = new TColStd_HArray1OfInteger(1, aLength - aRemLength);
-
-    for (j = 1; j <= aLength; j++) {
-      if (!mapIDsToRemove.Contains(aSeq->Value(j))) {
-        aNewSeq->SetValue(k, aSeq->Value(j));
-        k++;
+    Handle(TColStd_HArray1OfInteger) aNewSeq;
+    if ( aLength - aRemLength > 0 ) {
+      aNewSeq = new TColStd_HArray1OfInteger(1, aLength - aRemLength);
+      for (j = 1; j <= aLength; j++) {
+       if (!mapIDsToRemove.Contains(aSeq->Value(j))) {
+         aNewSeq->SetValue(k, aSeq->Value(j));
+         k++;
+       }
       }
     }
+    else {
+      aNewSeq = new TColStd_HArray1OfInteger(1,1);
+      aNewSeq->SetValue(1, -1);
+    }
 
     aSSI.SetIndices(aNewSeq);