diff options
Diffstat (limited to 'AssetLoader/src/GLTFResourceManager.cpp')
| -rw-r--r-- | AssetLoader/src/GLTFResourceManager.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
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<ITextureAtlasSuballocation> ResourceManager::FindAllocation(const { RefCntAutoPtr<ITextureAtlasSuballocation> pAllocation; - std::lock_guard<std::mutex> 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<std::mutex> 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; |
