Browse Source

Merge pull request #4446 from assimp/kimkulling/mdlimporter_fix_nullptr_dereferencing

Fix nullptr dereferencing
Kim Kulling 3 years ago
parent
commit
a828114a1d
1 changed files with 3 additions and 0 deletions
  1. 3 0
      code/AssetLib/MDL/MDLLoader.cpp

+ 3 - 0
code/AssetLib/MDL/MDLLoader.cpp

@@ -857,6 +857,9 @@ void MDLImporter::CalculateUVCoordinates_MDL5() {
             const float fHeight = (float)iHeight;
             aiMesh *pcMesh = this->pScene->mMeshes[0];
             for (unsigned int i = 0; i < pcMesh->mNumVertices; ++i) {
+                if (!pcMesh->HasTextureCoords(0)) {
+                    continue;
+                }
                 pcMesh->mTextureCoords[0][i].x /= fWidth;
                 pcMesh->mTextureCoords[0][i].y /= fHeight;
                 pcMesh->mTextureCoords[0][i].y = 1.0f - pcMesh->mTextureCoords[0][i].y; // DX to OGL