Fix crash when trying to open unreadable IWAD files

This commit is contained in:
Cacodemon345 2021-02-12 11:52:26 +06:00 committed by Christoph Oelckers
commit 349a2e9235
3 changed files with 20 additions and 2 deletions

View file

@ -577,10 +577,10 @@ int FIWadManager::IdentifyVersion (TArray<FString> &wadfiles, const char *iwad,
// -iwad not found or not specified. Revert back to standard behavior.
if (mFoundWads.Size() == numFoundWads) iwadparm = nullptr;
// Check for symbolic links leading to non-existent files.
// Check for symbolic links leading to non-existent files and for files that are unreadable.
for (unsigned int i = 0; i < mFoundWads.Size(); i++)
{
if (!FileExists(mFoundWads[i].mFullPath)) mFoundWads.Delete(i);
if (!FileExists(mFoundWads[i].mFullPath) || !FileReadable(mFoundWads[i].mFullPath)) mFoundWads.Delete(i);
}
// Now check if what got collected actually is an IWAD.