Browse Source

Obj: make a predicate more robust.

Since we might encounter invalid input it is a good idea to check the actual
size of the array.
Hill Ma 4 years ago
parent
commit
8d6d6b48c3
1 changed files with 1 additions and 1 deletions
  1. 1 1
      code/AssetLib/Obj/ObjFileImporter.cpp

+ 1 - 1
code/AssetLib/Obj/ObjFileImporter.cpp

@@ -468,7 +468,7 @@ void ObjFileImporter::createVertexArray(const ObjFile::Model *pModel,
             }
 
             // Copy all vertex colors
-            if (!pModel->m_VertexColors.empty()) {
+            if (vertex < pModel->m_VertexColors.size()) {
                 const aiVector3D &color = pModel->m_VertexColors[vertex];
                 pMesh->mColors[0][newIndex] = aiColor4D(color.x, color.y, color.z, 1.0);
             }