mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-22 06:13:45 -07:00
Prevent cached resource from being acquired while it is being destroyed
Fixes #158
This commit is contained in:
parent
4a05b32755
commit
1a24bb2057
1 changed files with 5 additions and 2 deletions
|
@ -193,9 +193,12 @@ 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…
Add table
Add a link
Reference in a new issue