summaryrefslogtreecommitdiff
path: root/Source/Core/UICommon/GameFileCache.cpp
diff options
context:
space:
mode:
authorMat M <mathew1800@gmail.com>2018-03-29 18:49:38 -0400
committerGitHub <noreply@github.com>2018-03-29 18:49:38 -0400
commitfc99b21080e4d7b7cb51673a7c5b9912ab54f774 (patch)
treefcae224c39222a0563a36f82491bbd10591907a2 /Source/Core/UICommon/GameFileCache.cpp
parent65a1065cde370054aba80b63c37cd773c282c6bc (diff)
parentff2fe73ec9c705431deeaf5bdff48d777adec0d5 (diff)
Merge pull request #6560 from JosJuice/invalid-games-in-game-list
DolphinQt2: Don't show invalid games in game list
Diffstat (limited to 'Source/Core/UICommon/GameFileCache.cpp')
-rw-r--r--Source/Core/UICommon/GameFileCache.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/Source/Core/UICommon/GameFileCache.cpp b/Source/Core/UICommon/GameFileCache.cpp
index a0e1253c18..c25254ee15 100644
--- a/Source/Core/UICommon/GameFileCache.cpp
+++ b/Source/Core/UICommon/GameFileCache.cpp
@@ -28,7 +28,7 @@
namespace UICommon
{
-static constexpr u32 CACHE_REVISION = 7; // Last changed in PR 6281
+static constexpr u32 CACHE_REVISION = 8; // Last changed in PR 6560
std::vector<std::string> FindAllGamePaths(const std::vector<std::string>& directories_to_scan,
bool recursive_scan)
@@ -60,7 +60,12 @@ std::shared_ptr<const GameFile> GameFileCache::AddOrGet(const std::string& path,
[&path](const std::shared_ptr<GameFile>& file) { return file->GetFilePath() == path; });
const bool found = it != m_cached_files.cend();
if (!found)
- m_cached_files.emplace_back(std::make_shared<GameFile>(path));
+ {
+ std::shared_ptr<UICommon::GameFile> game = std::make_shared<GameFile>(path);
+ if (!game->IsValid())
+ return nullptr;
+ m_cached_files.emplace_back(std::move(game));
+ }
std::shared_ptr<GameFile>& result = found ? *it : m_cached_files.back();
if (UpdateAdditionalMetadata(&result, title_database) || !found)
*cache_changed = true;