From 496a4bf156d4ca999e0afea756592aa5a1e03dd8 Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 2 Jun 2023 11:33:54 +0000 Subject: [PATCH 1/2] Fix unknown write in Assimp::ObjFileMtlImporter::getFloatValue --- code/AssetLib/Obj/ObjFileMtlImporter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/AssetLib/Obj/ObjFileMtlImporter.cpp b/code/AssetLib/Obj/ObjFileMtlImporter.cpp index 2c3ce9ee5..f7d66d11b 100644 --- a/code/AssetLib/Obj/ObjFileMtlImporter.cpp +++ b/code/AssetLib/Obj/ObjFileMtlImporter.cpp @@ -252,9 +252,9 @@ void ObjFileMtlImporter::load() { case 'a': // Anisotropy { ++m_DataIt; - getFloatValue(m_pModel->mCurrentMaterial->anisotropy); if (m_pModel->mCurrentMaterial != nullptr) - m_DataIt = skipLine(m_DataIt, m_DataItEnd, m_uiLine); + getFloatValue(m_pModel->mCurrentMaterial->anisotropy); + m_DataIt = skipLine(m_DataIt, m_DataItEnd, m_uiLine); } break; default: { From 646d3591b625b5a7bab6f73e8d4d6239dce90035 Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 2 Jun 2023 11:34:07 +0000 Subject: [PATCH 2/2] Fix memory leak --- code/AssetLib/Obj/ObjFileMtlImporter.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/code/AssetLib/Obj/ObjFileMtlImporter.cpp b/code/AssetLib/Obj/ObjFileMtlImporter.cpp index f7d66d11b..f8e3e1cde 100644 --- a/code/AssetLib/Obj/ObjFileMtlImporter.cpp +++ b/code/AssetLib/Obj/ObjFileMtlImporter.cpp @@ -371,6 +371,7 @@ void ObjFileMtlImporter::getTexture() { if (m_pModel->mCurrentMaterial == nullptr) { m_pModel->mCurrentMaterial = new ObjFile::Material(); m_pModel->mCurrentMaterial->MaterialName.Set("Empty_Material"); + m_pModel->mMaterialMap["Empty_Material"] = m_pModel->mCurrentMaterial; } const char *pPtr(&(*m_DataIt));