Skip to content

Commit

Permalink
Refuse to load invalid esp/esm files
Browse files Browse the repository at this point in the history
If there isn't a valid TES3 record at the start of the file, then assume it's invalid
  • Loading branch information
pineapplemachine committed Aug 21, 2018
1 parent 6dd5ce9 commit 4ae3140
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/load_es_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ def read_elder_scrolls_file(path, binary_file):
while True:
record = read_record(es_file, binary_file)
if record:
if not len(es_file.records) and record.type_name != b"TES3":
raise Exception("File is not a TES3 ESM or ESP.")
es_file.records.append(record)
else:
break
Expand Down

0 comments on commit 4ae3140

Please sign in to comment.