summaryrefslogtreecommitdiffstats
path: root/AssetLoader/src/GLTFResourceManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'AssetLoader/src/GLTFResourceManager.cpp')
-rw-r--r--AssetLoader/src/GLTFResourceManager.cpp17
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;