Commit e663fb9b authored by Matthias Möller's avatar Matthias Möller
Browse files

fix crash when saving a mesh and a custom property was removed before

extend unittest for this case

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@1323 fdac6126-5c0c-442c-9429-916003d36597
parent 68fe500f
......@@ -207,7 +207,7 @@ std::vector<_PLYWriter_::CustomProperty> _PLYWriter_::writeCustomTypeHeader(std:
// check, if property is persistant
if (!prop->persistent())
if (!prop || !prop->persistent())
continue;
......
......@@ -538,20 +538,24 @@ TEST_F(OpenMeshReadWritePLY, WriteReadSimplePLYWithCustomProps) {
OpenMesh::VPropHandleT<unsigned int> nonPersistant;
OpenMesh::VPropHandleT<double> qualityProp;
OpenMesh::FPropHandleT<signed int> faceProp;
OpenMesh::VPropHandleT<int> 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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment