Merge pull request #3502 from MalcolmTyrrell/fbxTextureFix

Prevent crash with malformed texture reference
pull/3501/head^2
Kim Kulling 2020-11-16 21:51:41 +01:00 committed by GitHub
commit 25aaa333eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 4 deletions

View File

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