Avoid creating a fileloader during shutdown.

Some silliness I found while investigating using SuperLuminal.
This commit is contained in:
Henrik Rydgård 2022-04-12 00:15:52 +02:00
parent d1e2b19ebb
commit 6de574104c
2 changed files with 11 additions and 3 deletions

View file

@ -677,9 +677,13 @@ void GameInfoCache::Clear() {
void GameInfoCache::CancelAll() { void GameInfoCache::CancelAll() {
for (auto info : info_) { for (auto info : info_) {
auto fl = info.second->GetFileLoader(); // GetFileLoader will create one if there isn't one already.
if (fl) { // Avoid that by checking.
fl->Cancel(); if (info.second->HasFileLoader()) {
auto fl = info.second->GetFileLoader();
if (fl) {
fl->Cancel();
}
} }
} }
} }

View file

@ -87,6 +87,10 @@ public:
bool DeleteAllSaveData(); bool DeleteAllSaveData();
bool LoadFromPath(const Path &gamePath); bool LoadFromPath(const Path &gamePath);
bool HasFileLoader() const {
return fileLoader.get() != nullptr;
}
std::shared_ptr<FileLoader> GetFileLoader(); std::shared_ptr<FileLoader> GetFileLoader();
void DisposeFileLoader(); void DisposeFileLoader();