From e3f40f6c369c63982b79d3485c0fc7260759b6e9 Mon Sep 17 00:00:00 2001 From: dibenedetto Date: Mon, 22 Jun 2009 16:53:40 +0000 Subject: [PATCH] added checks for components before accessing them. --- wrap/io_trimesh/import_obj.h | 89 +++++++++++++++++++++++------------- 1 file changed, 58 insertions(+), 31 deletions(-) diff --git a/wrap/io_trimesh/import_obj.h b/wrap/io_trimesh/import_obj.h index c0005a86..f4494602 100644 --- a/wrap/io_trimesh/import_obj.h +++ b/wrap/io_trimesh/import_obj.h @@ -344,8 +344,10 @@ static int Open( OpenMeshType &m, const char * filename, Info &oi) // assigning vertex color // ---------------------- - if( oi.mask & vcg::tri::io::Mask::IOM_VERTCOLOR) + if (((oi.mask & vcg::tri::io::Mask::IOM_VERTCOLOR) != 0) && (m.HasPerVertexColor())) + { (*vi).C() = currentColor; + } ++vi; // move to next vertex iterator @@ -610,37 +612,62 @@ static int Open( OpenMeshType &m, const char * filename, Info &oi) FaceIterator fi = Allocator::AddFaces(m,numTriangles); //------------------------------------------------------------------------------- - // Now the final pass to convert indexes into pointers for face to vert/norm/tex references - for(int i=0;i