瀏覽代碼

Merge pull request #4284 from assimp/kimkulling-skip_empty_embedded_textures_issue4238

MDL: Do not try to copy empty embedded texture
Kim Kulling 3 年之前
父節點
當前提交
4d7e817bd8
共有 1 個文件被更改,包括 6 次插入2 次删除
  1. 6 2
      code/AssetLib/MDL/MDLMaterialLoader.cpp

+ 6 - 2
code/AssetLib/MDL/MDLMaterialLoader.cpp

@@ -463,8 +463,12 @@ void MDLImporter::ParseSkinLump_3DGS_MDL7(
             ASSIMP_LOG_WARN("Found a reference to an embedded DDS texture, "
             ASSIMP_LOG_WARN("Found a reference to an embedded DDS texture, "
                             "but texture height is not equal to 1, which is not supported by MED");
                             "but texture height is not equal to 1, which is not supported by MED");
         }
         }
-
-        pcNew.reset(new aiTexture());
+        if (iWidth == 0) {
+            ASSIMP_LOG_ERROR("Found a reference to an embedded DDS texture, but texture width is zero, aborting import.");
+            return;
+        }
+        
+        pcNew.reset(new aiTexture);
         pcNew->mHeight = 0;
         pcNew->mHeight = 0;
         pcNew->mWidth = iWidth;
         pcNew->mWidth = iWidth;