diff pytouhou/formats/exe.py @ 367:2674c789e0c3

Various optimizations
author Thibaut Girka <thib@sitedethib.com>
date Tue, 10 Jul 2012 00:25:08 +0200
parents 5492472963b0
children b11953cf1d3b
line wrap: on
line diff
--- a/pytouhou/formats/exe.py
+++ b/pytouhou/formats/exe.py
@@ -141,12 +141,11 @@ class SHT(object):
         data_va = pe_file.image_base + data_section.VirtualAddress
         data_size = data_section.SizeOfRawData
 
-        possible_character_records = list(cls.find_character_defs(pe_file))
-        if not possible_character_records:
+        try:
+            character_records_va = next(cls.find_character_defs(pe_file))
+        except StopIteration:
             raise InvalidExeException
 
-        character_records_va = possible_character_records[0]
-
         characters = []
         shots_offsets = {}
         for character in xrange(4):