mirror of
https://github.com/stenzek/duckstation.git
synced 2025-06-07 12:05:52 +00:00
GameList: Fix crash if cache fails to open
This commit is contained in:
parent
ece18d10c5
commit
ceef7af1da
@ -289,7 +289,7 @@ BinaryFileReader& BinaryFileReader::operator=(BinaryFileReader&& move)
|
|||||||
|
|
||||||
bool BinaryFileReader::IsAtEnd()
|
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)
|
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.");
|
WARNING_LOG("Initializing game list cache.");
|
||||||
s_cache_map.clear();
|
s_cache_map.clear();
|
||||||
|
if (!fp)
|
||||||
|
return false;
|
||||||
|
|
||||||
// Truncate file, and re-write header.
|
// Truncate file, and re-write header.
|
||||||
Error error;
|
Error error;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user