From: ageay Date: Tue, 24 Apr 2012 08:27:15 +0000 (+0000) Subject: Protection of invalid writeVTK on 0 cell mesh. X-Git-Tag: TRIPOLI_323~35 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8fa98036430c07bc53a596966ecf1102e92402bc;p=tools%2Fmedcoupling.git Protection of invalid writeVTK on 0 cell mesh. --- diff --git a/src/MEDCoupling/MEDCouplingUMesh.cxx b/src/MEDCoupling/MEDCouplingUMesh.cxx index 92c2f95c4..847b22a71 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh.cxx @@ -5228,6 +5228,8 @@ void MEDCouplingUMesh::FillInCompact3DMode(int spaceDim, int nbOfNodesInCell, co void MEDCouplingUMesh::writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData) const throw(INTERP_KERNEL::Exception) { + if(getNumberOfCells()<=0) + throw INTERP_KERNEL::Exception("MEDCouplingUMesh::writeVTK : the unstructured mesh has no cells !"); static const int PARAMEDMEM2VTKTYPETRADUCER[INTERP_KERNEL::NORM_MAXTYPE+1]={1,3,21,5,9,7,22,-1,23,-1,-1,-1,-1,-1,10,14,13,-1,12,-1,24,-1,16,27,-1,26,-1,-1,-1,-1,25,42,-1,4}; ofs << " <" << getVTKDataSetType() << ">\n"; ofs << " \n";