diff --git a/src/d_iwad.cpp b/src/d_iwad.cpp index 9691b9cdf..6422b8898 100644 --- a/src/d_iwad.cpp +++ b/src/d_iwad.cpp @@ -598,14 +598,17 @@ int FIWadManager::IdentifyVersion (TArray &wadfiles, const char *iwad, bool picked = false; for (int j = 0; j < (int)mFoundWads.Size(); j++) { - if (mIWadInfos[mFoundWads[j].mInfoIndex].Name.Compare(mOrderNames[i]) == 0) + if (mFoundWads[j].mInfoIndex >= 0) { - if (!picked) + if (mIWadInfos[mFoundWads[j].mInfoIndex].Name.Compare(mOrderNames[i]) == 0) { - picked = true; - picks.Push(mFoundWads[j]); + if (!picked) + { + picked = true; + picks.Push(mFoundWads[j]); + } + mFoundWads.Delete(j--); } - mFoundWads.Delete(j--); } } }