From: eap Date: Wed, 15 Feb 2017 16:29:50 +0000 (+0300) Subject: 23413: [CEA 2025] bug SMESH orientation X-Git-Tag: V8_3_0a2~18 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=16c26c947bdaa64155472325734c19eaf9356d89;p=tools%2Fmedcoupling.git 23413: [CEA 2025] bug SMESH orientation Avoid crash on an empty group --- diff --git a/src/MEDLoader/SauvWriter.cxx b/src/MEDLoader/SauvWriter.cxx index 474059de7..a337b1778 100644 --- a/src/MEDLoader/SauvWriter.cxx +++ b/src/MEDLoader/SauvWriter.cxx @@ -450,17 +450,21 @@ void SauvWriter::fillGroupSubMeshes() ++k; } } + if ( k == 0 ) + continue; // if a family exists but has no element, no submesh has been found for this family // => we have to resize famSubMeshes with the number of submeshes stored if (k != famNames.size()) - famSubMeshes.resize(k); + famSubMeshes.resize(k); SubMesh* grpSubMesh = addSubMesh( groupName, famSubMeshes[0]->_dimRelExt ); - if(!_cpy_grp_if_on_single_family) - grpSubMesh->_subs.swap( famSubMeshes ); + if( ! _cpy_grp_if_on_single_family ) + { + grpSubMesh->_subs.swap( famSubMeshes ); + } else { - /* If a group sub mesh consists of only one family, the group is written as - * a copy of this family. + /* If a group sub mesh consists of only one family, the group is written as + * a copy of this family. * A mesh composed of only one submesh may cause an issue with some Gibi operators.*/ if (famSubMeshes.size() == 1) {