From: vsr Date: Fri, 22 Apr 2011 14:44:29 +0000 (+0000) Subject: Fix problem in DifferenceList() function: when group becomes empty, an invalid compou... X-Git-Tag: V6_3_0b1~21 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=fa7612374ad996fac6340e7478d47eb2db8bbc11;p=modules%2Fgeom.git Fix problem in DifferenceList() function: when group becomes empty, an invalid compound is created by error. --- diff --git a/src/GEOMImpl/GEOMImpl_IGroupOperations.cxx b/src/GEOMImpl/GEOMImpl_IGroupOperations.cxx index cf81ed23c..86ed5fbe7 100644 --- a/src/GEOMImpl/GEOMImpl_IGroupOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IGroupOperations.cxx @@ -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);