diff --git a/Stream_support/include/CGAL/IO/PLY.h b/Stream_support/include/CGAL/IO/PLY.h index 6c02e5f1dd6..d5bf4f5c8b3 100644 --- a/Stream_support/include/CGAL/IO/PLY.h +++ b/Stream_support/include/CGAL/IO/PLY.h @@ -375,6 +375,7 @@ public: t = property->buffer(); return; } + t = {}; } template @@ -389,6 +390,7 @@ public: t = property->buffer(); return; } + t = {}; } void assign (double& t, const char* tag) @@ -410,6 +412,7 @@ public: return; } + t = {}; } }; diff --git a/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h b/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h index 8985f14dc6d..b55bf59423d 100644 --- a/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h +++ b/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h @@ -2212,22 +2212,35 @@ private: //------------------------------------------------------- private data std::vector*> fprinters; internal::PLY::fill_header (os, sm, fprinters); + std::vector*> eprinters; if (sm.template properties().size() > 1) { - os << "element edge " << sm.number_of_edges() << std::endl; - os << "property int v0" << std::endl; - os << "property int v1" << std::endl; - internal::PLY::fill_header (os, sm, eprinters); + std::ostringstream oss; + internal::PLY::fill_header (oss, sm, eprinters); + + if (!eprinters.empty()) + { + os << "element edge " << sm.number_of_edges() << std::endl; + os << "property int v0" << std::endl; + os << "property int v1" << std::endl; + os << oss.str(); + } } std::vector*> hprinters; if (sm.template properties().size() > 1) { - os << "element halfedge " << sm.number_of_halfedges() << std::endl; - os << "property int source" << std::endl; - os << "property int target" << std::endl; - internal::PLY::fill_header (os, sm, hprinters); + std::ostringstream oss; + internal::PLY::fill_header (oss, sm, hprinters); + + if (!hprinters.empty()) + { + os << "element halfedge " << sm.number_of_halfedges() << std::endl; + os << "property int source" << std::endl; + os << "property int target" << std::endl; + os << oss.str(); + } } os << "end_header" << std::endl;