diff --git a/libultraship/libultraship/ResourceMgr.cpp b/libultraship/libultraship/ResourceMgr.cpp index e6f3c8a0a..b4d7b76a8 100644 --- a/libultraship/libultraship/ResourceMgr.cpp +++ b/libultraship/libultraship/ResourceMgr.cpp @@ -217,9 +217,12 @@ namespace Ship { std::shared_ptr 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; }