- Handle(TColStd_HArray1OfInteger) array = new TColStd_HArray1OfInteger(1, nbElt);
- int j = 0;
- for (std::set<int>::iterator it = xaoGroup->begin(); it != xaoGroup->end(); ++it)
- {
- int index = (*it);
- std::string ref = xaoGeometry->getElementReference(xaoGroup->getDimension(), index);
- array->SetValue(++j, XAO::XaoUtils::stringToInt(ref));
+ Handle(TColStd_HArray1OfInteger) array;
+ if (nbElt > 0) {
+ array = new TColStd_HArray1OfInteger(1, nbElt);
+ int j = 0;
+ for (std::set<int>::iterator it = xaoGroup->begin(); it != xaoGroup->end(); ++it) {
+ int index = (*it);
+ std::string ref = xaoGeometry->getElementReference(xaoGroup->getDimension(), index);
+ array->SetValue(++j, XAO::XaoUtils::stringToInt(ref));
+ }
+ }
+ else { // empty group
+ array = new TColStd_HArray1OfInteger(1, 1);
+ array->SetValue(1, -1);