ソースを参照

Check that positions exist before accessing them

Max Vollmer (Microsoft Havok) 3 年 前
コミット
5e1188c44e
1 ファイル変更3 行追加1 行削除
  1. 3 1
      include/assimp/Vertex.h

+ 3 - 1
include/assimp/Vertex.h

@@ -135,7 +135,9 @@ public:
     /** Extract a particular vertex from a anim mesh and interleave all components */
     /** Extract a particular vertex from a anim mesh and interleave all components */
     explicit Vertex(const aiAnimMesh* msh, unsigned int idx) {
     explicit Vertex(const aiAnimMesh* msh, unsigned int idx) {
         ai_assert(idx < msh->mNumVertices);
         ai_assert(idx < msh->mNumVertices);
-        position = msh->mVertices[idx];
+        if (msh->HasPositions()) {
+            position = msh->mVertices[idx];
+        }
 
 
         if (msh->HasNormals()) {
         if (msh->HasNormals()) {
             normal = msh->mNormals[idx];
             normal = msh->mNormals[idx];