From ff2fe73ec9c705431deeaf5bdff48d777adec0d5 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Thu, 29 Mar 2018 21:52:21 +0200 Subject: DolphinQt2: Don't show invalid games in game list Regression from 1f1dae3. This problem doesn't happen in DolphinWX as far as I know, but if you've ran into the problem in DolphinQt2, it will carry over to DolphinWX because of the shared game list cache. --- Source/Core/UICommon/GameFileCache.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'Source/Core/UICommon/GameFileCache.cpp') 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 FindAllGamePaths(const std::vector& directories_to_scan, bool recursive_scan) @@ -60,7 +60,12 @@ std::shared_ptr GameFileCache::AddOrGet(const std::string& path, [&path](const std::shared_ptr& file) { return file->GetFilePath() == path; }); const bool found = it != m_cached_files.cend(); if (!found) - m_cached_files.emplace_back(std::make_shared(path)); + { + std::shared_ptr game = std::make_shared(path); + if (!game->IsValid()) + return nullptr; + m_cached_files.emplace_back(std::move(game)); + } std::shared_ptr& result = found ? *it : m_cached_files.back(); if (UpdateAdditionalMetadata(&result, title_database) || !found) *cache_changed = true; -- cgit v1.2.3