- GEOM::GEOM_IGroupOperations_var aGroupOp =
- theGeomEngine->GetIGroupOperations( theStudy->StudyId() );
-
- foreach ( const QString& aGroupName, aGroupsData.keys() ) {
- QSet<int> aGroupIndexes = aGroupsData.value( aGroupName );
-
- GEOM::GEOM_Object_var aGroup = aGroupOp->CreateGroup( aMainShape, TopAbs_EDGE );
- if ( !CORBA::is_nil(aGroup) && aGroupOp->IsDone() ) {
- GEOM::ListOfLong_var anIndexes = new GEOM::ListOfLong;
- int aListIndex = 0;
- foreach ( const int anIndex, aGroupIndexes ) {
- anIndexes[aListIndex++] = anIndex;
- }
+ if ( !aGroupsData.isEmpty() ) {
+ GEOM::GEOM_IGroupOperations_var aGroupOp =
+ theGeomEngine->GetIGroupOperations( theStudy->StudyId() );
+
+ foreach ( const QString& aGroupName, aGroupsData.keys() ) {
+ QSet<int> aGroupIndexes = aGroupsData.value( aGroupName );
+
+ GEOM::GEOM_Object_var aGroup = aGroupOp->CreateGroup( aMainShape, TopAbs_EDGE );
+ if ( !CORBA::is_nil(aGroup) && aGroupOp->IsDone() ) {
+ GEOM::ListOfLong_var anIndexes = new GEOM::ListOfLong;
+ anIndexes->length( aGroupIndexes.count() );
+ int aListIndex = 0;
+ foreach ( const int anIndex, aGroupIndexes ) {
+ anIndexes[aListIndex++] = anIndex;
+ }