From 0a30c19138b19dfd9555d3362e446495b10b4f52 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Fri, 12 Feb 2021 00:10:05 +0600 Subject: [PATCH] Fix crash when following symlinks to nonexistent IWAD files --- src/d_iwad.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/d_iwad.cpp b/src/d_iwad.cpp index bbecbf81b..289b67671 100644 --- a/src/d_iwad.cpp +++ b/src/d_iwad.cpp @@ -577,6 +577,12 @@ int FIWadManager::IdentifyVersion (TArray &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. + for (unsigned int i = 0; i < mFoundWads.Size(); i++) + { + if (!FileExists(mFoundWads[i].mFullPath)) mFoundWads.Delete(i); + } + // Now check if what got collected actually is an IWAD. ValidateIWADs();