Prevent crash with malformed texture reference

pull/3502/head
Malcolm Tyrrell 2020-11-16 17:29:19 +00:00
parent 5e7d6a0e41
commit 3221522f95
1 changed files with 5 additions and 4 deletions

View File

@ -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