check that index file name isn't same as a source file name.

This commit is contained in:
morkt 2015-09-22 22:40:52 +04:00
parent f9448e4613
commit 69658a505c

View File

@ -51,7 +51,8 @@ namespace GameRes.Formats.Eagls
public override ArcFile TryOpen (ArcView file) public override ArcFile TryOpen (ArcView file)
{ {
string idx_name = Path.ChangeExtension (file.Name, ".idx"); string idx_name = Path.ChangeExtension (file.Name, ".idx");
if (!VFS.FileExists (idx_name)) if (file.Name.Equals (idx_name, StringComparison.InvariantCultureIgnoreCase)
|| !VFS.FileExists (idx_name))
return null; return null;
var idx_entry = VFS.FindFile (idx_name); var idx_entry = VFS.FindFile (idx_name);
if (idx_entry.Size > 0xfffff || idx_entry.Size < 10000) if (idx_entry.Size > 0xfffff || idx_entry.Size < 10000)