diff --git a/components/bsa/bsa_file.cpp b/components/bsa/bsa_file.cpp index 3375882f52..4dfaa8658d 100644 --- a/components/bsa/bsa_file.cpp +++ b/components/bsa/bsa_file.cpp @@ -182,8 +182,6 @@ void BSAFile::readHeader() if(fs.offset + fs.fileSize > fsize) fail("Archive contains offsets outside itself"); - // Add the file name to the lookup - mLookup[fs.name()] = i; } mStringBuf.resize(endOfNameBuffer); @@ -191,6 +189,13 @@ void BSAFile::readHeader() return left.offset < right.offset; }); + for (size_t i = 0; i < filenum; i++) + { + FileStruct& fs = mFiles[i]; + // Add the file name to the lookup + mLookup[fs.name()] = i; + } + mIsLoaded = true; }