mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-25 19:02: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) {
|
std::shared_ptr<Ship::Resource> ResourceMgr::GetCachedFile(std::string FilePath) {
|
||||||
auto resCacheFind = ResourceCache.find(FilePath);
|
auto resCacheFind = ResourceCache.find(FilePath);
|
||||||
|
|
||||||
if (resCacheFind != ResourceCache.end())
|
if (resCacheFind != ResourceCache.end() &&
|
||||||
|
resCacheFind->second.use_count() > 0)
|
||||||
|
{
|
||||||
return resCacheFind->second;
|
return resCacheFind->second;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user