Merge branch 'OMWriterCrashFix' into 'master'

fix crash in OMWriter when writing an empty mesh with colors

Writer accessed VertexHandle(0) for meshes with colors even when they had no vertices.

See merge request !34
This commit is contained in:
Jan Möbius
2015-12-15 08:08:52 +01:00

View File

@@ -248,7 +248,7 @@ bool _OMWriter_::write_binary(std::ostream& _os, BaseExporter& _be,
} }
// ---------- write vertex color // ---------- write vertex color
if (_opt.check( Options::VertexColor ) && _be.has_vertex_colors() ) if (_be.n_vertices() && _opt.check( Options::VertexColor ) && _be.has_vertex_colors() )
{ {
Vec3uc c = _be.color(VertexHandle(0)); Vec3uc c = _be.color(VertexHandle(0));