(TryOpen): fixed skipping of invalid entries.

This commit is contained in:
morkt 2015-03-31 14:41:27 +04:00
parent dba869d134
commit 336d5c7174

View File

@ -82,7 +82,7 @@ namespace GameRes.Formats.NeXAS
var index = HuffmanDecode (index_packed, count*0x4c); var index = HuffmanDecode (index_packed, count*0x4c);
var dir = new List<Entry> (count); var dir = new List<Entry> (count);
int offset = 0; int offset = 0;
for (int i = 0; i < count; ++i) for (int i = 0; i < count; ++i, offset += 0x4c)
{ {
int name_length = 0; int name_length = 0;
while (name_length < 0x40 && 0 != index[offset+name_length]) while (name_length < 0x40 && 0 != index[offset+name_length])
@ -102,7 +102,6 @@ namespace GameRes.Formats.NeXAS
return null; return null;
entry.IsPacked = pack_type != 0 && entry.UnpackedSize != entry.Size; entry.IsPacked = pack_type != 0 && entry.UnpackedSize != entry.Size;
dir.Add (entry); dir.Add (entry);
offset += 0x4c;
} }
if (0 == pack_type) if (0 == pack_type)
return new ArcFile (file, this, dir); return new ArcFile (file, this, dir);