From 3905951ca5e89937edb120105ca9790164ac8e70 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Thu, 11 Apr 2024 11:12:02 +0200 Subject: [PATCH] Update ComputeUVMappingProcess.cpp - closes https://github.com/assimp/assimp/issues/5540 --- code/PostProcessing/ComputeUVMappingProcess.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/code/PostProcessing/ComputeUVMappingProcess.cpp b/code/PostProcessing/ComputeUVMappingProcess.cpp index 2aa34de28..b140deefc 100644 --- a/code/PostProcessing/ComputeUVMappingProcess.cpp +++ b/code/PostProcessing/ComputeUVMappingProcess.cpp @@ -346,16 +346,20 @@ void ComputeUVMappingProcess::Execute(aiScene *pScene) { ASSIMP_LOG_DEBUG("GenUVCoordsProcess begin"); char buffer[1024]; - if (pScene->mFlags & AI_SCENE_FLAGS_NON_VERBOSE_FORMAT) + if (pScene->mFlags & AI_SCENE_FLAGS_NON_VERBOSE_FORMAT) { throw DeadlyImportError("Post-processing order mismatch: expecting pseudo-indexed (\"verbose\") vertices here"); + } std::list mappingStack; - /* Iterate through all materials and search for non-UV mapped textures - */ + // Iterate through all materials and search for non-UV mapped textures for (unsigned int i = 0; i < pScene->mNumMaterials; ++i) { mappingStack.clear(); aiMaterial *mat = pScene->mMaterials[i]; + if (mat == nullptr) { + ASSIMP_LOG_INFO("Material pointer in nullptr, skipping.); + continue; + } for (unsigned int a = 0; a < mat->mNumProperties; ++a) { aiMaterialProperty *prop = mat->mProperties[a]; if (!::strcmp(prop->mKey.data, "$tex.mapping")) {