diff --git a/src/OpenMesh/Core/IO/writer/PLYWriter.cc b/src/OpenMesh/Core/IO/writer/PLYWriter.cc index 6108b0c6..49186c90 100644 --- a/src/OpenMesh/Core/IO/writer/PLYWriter.cc +++ b/src/OpenMesh/Core/IO/writer/PLYWriter.cc @@ -207,7 +207,7 @@ std::vector<_PLYWriter_::CustomProperty> _PLYWriter_::writeCustomTypeHeader(std: // check, if property is persistant - if (!prop->persistent()) + if (!prop || !prop->persistent()) continue; diff --git a/src/Unittests/unittests_read_write_PLY.cc b/src/Unittests/unittests_read_write_PLY.cc index 9cffffa8..d7a27fe2 100644 --- a/src/Unittests/unittests_read_write_PLY.cc +++ b/src/Unittests/unittests_read_write_PLY.cc @@ -538,20 +538,24 @@ TEST_F(OpenMeshReadWritePLY, WriteReadSimplePLYWithCustomProps) { OpenMesh::VPropHandleT nonPersistant; OpenMesh::VPropHandleT qualityProp; OpenMesh::FPropHandleT faceProp; + OpenMesh::VPropHandleT removedProp; const std::string indexPropName = "mySuperIndexProperty"; const std::string qualityPropName = "quality"; const std::string facePropName = "anotherPropForFaces"; const std::string nonPersistantName = "nonPersistant"; + const std::string removedPropName = "willBeRemoved"; mesh.add_property(indexProp,indexPropName); mesh.add_property(qualityProp,qualityPropName); + mesh.add_property(removedProp, removedPropName); mesh.add_property(faceProp,facePropName); mesh.add_property(nonPersistant,nonPersistantName); mesh.property(indexProp).set_persistent(true); mesh.property(qualityProp).set_persistent(true); mesh.property(faceProp).set_persistent(true); + mesh.remove_property(removedProp); signed char i=0; for (Mesh::VertexIter v_iter = mesh.vertices_begin(); v_iter != mesh.vertices_end(); ++v_iter, ++i)