GameList: Fix crash if cache fails to open

pull/3397/head
Stenzek 8 months ago
parent ece18d10c5
commit ceef7af1da
No known key found for this signature in database

@ -289,7 +289,7 @@ BinaryFileReader& BinaryFileReader::operator=(BinaryFileReader&& move)
bool BinaryFileReader::IsAtEnd()
{
return (FileSystem::FTell64(m_fp) == m_size);
return (!m_fp || FileSystem::FTell64(m_fp) == m_size);
}
bool BinaryFileReader::ReadCString(std::string* dst)

@ -495,6 +495,8 @@ bool GameList::LoadOrInitializeCache(std::FILE* fp, bool invalidate_cache)
WARNING_LOG("Initializing game list cache.");
s_cache_map.clear();
if (!fp)
return false;
// Truncate file, and re-write header.
Error error;

Loading…
Cancel
Save