From 8d6d6b48c3dad5bb244c0bb7bb6097be4ff083eb Mon Sep 17 00:00:00 2001 From: Hill Ma Date: Mon, 2 Aug 2021 11:58:46 -0700 Subject: [PATCH] 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. --- code/AssetLib/Obj/ObjFileImporter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/AssetLib/Obj/ObjFileImporter.cpp b/code/AssetLib/Obj/ObjFileImporter.cpp index d6232be81..5e2b48e24 100644 --- a/code/AssetLib/Obj/ObjFileImporter.cpp +++ b/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); }