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
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user