mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-22 01:12:19 -05:00
Prevent cached resource from being acquired while it is being destroyed
Fixes #158
This commit is contained in:
parent
0ef2d0c750
commit
1aa08caade
@ -218,8 +218,11 @@ namespace Ship {
|
||||
std::shared_ptr<Ship::Resource> ResourceMgr::GetCachedFile(std::string FilePath) {
|
||||
auto resCacheFind = ResourceCache.find(FilePath);
|
||||
|
||||
if (resCacheFind != ResourceCache.end())
|
||||
if (resCacheFind != ResourceCache.end() &&
|
||||
resCacheFind->second.use_count() > 0)
|
||||
{
|
||||
return resCacheFind->second;
|
||||
}
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user