From f9f8a42f2b1265345f6d3b2d40fb23a744fa6a30 Mon Sep 17 00:00:00 2001 From: assiduous Date: Wed, 9 Dec 2020 21:17:25 -0800 Subject: GLTFLoader: made sure that texture files are not loaded when found in the cache --- AssetLoader/src/GLTFResourceManager.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'AssetLoader/src/GLTFResourceManager.cpp') diff --git a/AssetLoader/src/GLTFResourceManager.cpp b/AssetLoader/src/GLTFResourceManager.cpp index a30e265..54c3416 100644 --- a/AssetLoader/src/GLTFResourceManager.cpp +++ b/AssetLoader/src/GLTFResourceManager.cpp @@ -69,14 +69,17 @@ RefCntAutoPtr ResourceManager::FindAllocation(const { RefCntAutoPtr pAllocation; - std::lock_guard Lock{m_TexAllocationsMtx}; - - auto it = m_TexAllocations.find(CacheId); - if (it != m_TexAllocations.end()) + if (CacheId != nullptr && *CacheId != 0) { - pAllocation = it->second.Lock(); - if (!pAllocation) - m_TexAllocations.erase(it); + std::lock_guard Lock{m_TexAllocationsMtx}; + + auto it = m_TexAllocations.find(CacheId); + if (it != m_TexAllocations.end()) + { + pAllocation = it->second.Lock(); + if (!pAllocation) + m_TexAllocations.erase(it); + } } return pAllocation; -- cgit v1.2.3