From 8fa98036430c07bc53a596966ecf1102e92402bc Mon Sep 17 00:00:00 2001 From: ageay Date: Tue, 24 Apr 2012 08:27:15 +0000 Subject: [PATCH] Protection of invalid writeVTK on 0 cell mesh. --- src/MEDCoupling/MEDCouplingUMesh.cxx | 2 ++ 1 file changed, 2 insertions(+) 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"; -- 2.39.2