Преглед изворни кода

Merge pull request #3502 from MalcolmTyrrell/fbxTextureFix

Prevent crash with malformed texture reference
Kim Kulling пре 4 година
родитељ
комит
25aaa333eb
1 измењених фајлова са 5 додато и 4 уклоњено
  1. 5 4
      code/AssetLib/FBX/FBXConverter.cpp

+ 5 - 4
code/AssetLib/FBX/FBXConverter.cpp

@@ -3481,10 +3481,11 @@ void FBXConverter::ConvertOrphanedEmbeddedTextures() {
                 const char *obtype = key.begin();
                 const size_t length = static_cast<size_t>(key.end() - key.begin());
                 if (strncmp(obtype, "Texture", length) == 0) {
-                    const Texture *texture = static_cast<const Texture *>(object->Get());
-                    if (texture->Media() && texture->Media()->ContentLength() > 0) {
-                        realTexture = texture;
-                    }
+                    if (const Texture *texture = static_cast<const Texture *>(object->Get())) {
+                        if (texture->Media() && texture->Media()->ContentLength() > 0) {
+                            realTexture = texture;
+                        }
+                    }    
                 }
             } catch (...) {
                 // do nothing