From 3221522f9549fa6fae2ee932af8c1a274ce2998e Mon Sep 17 00:00:00 2001 From: Malcolm Tyrrell Date: Mon, 16 Nov 2020 17:29:19 +0000 Subject: [PATCH] Prevent crash with malformed texture reference --- code/AssetLib/FBX/FBXConverter.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/code/AssetLib/FBX/FBXConverter.cpp b/code/AssetLib/FBX/FBXConverter.cpp index c7bc57d97..a7f9e6832 100644 --- a/code/AssetLib/FBX/FBXConverter.cpp +++ b/code/AssetLib/FBX/FBXConverter.cpp @@ -3481,10 +3481,11 @@ void FBXConverter::ConvertOrphanedEmbeddedTextures() { const char *obtype = key.begin(); const size_t length = static_cast(key.end() - key.begin()); if (strncmp(obtype, "Texture", length) == 0) { - const Texture *texture = static_cast(object->Get()); - if (texture->Media() && texture->Media()->ContentLength() > 0) { - realTexture = texture; - } + if (const Texture *texture = static_cast(object->Get())) { + if (texture->Media() && texture->Media()->ContentLength() > 0) { + realTexture = texture; + } + } } } catch (...) { // do nothing