Skip to content

Commit 3396985

Browse files
committed
Temporary patch for #68.
1 parent 06e6131 commit 3396985

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

sc2reader/resources.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -588,16 +588,20 @@ def __init__(self, map_file, filename=None, gateway=None, map_hash=None, **optio
588588
self.archive = MPQArchive(map_file)
589589
self.minimap = self.archive.read_file('Minimap.tga')
590590

591-
# TODO: We probably shouldn't favor enUS here?
591+
# This will only populate the fields for maps with enUS localizations.
592+
# Clearly this isn't a great solution but we can't be throwing exceptions
593+
# just because US English wasn't a concern of the map author.
594+
# TODO: Make this work regardless of the localizations available.
592595
game_strings = self.archive.read_file('enUS.SC2Data\LocalizedData\GameStrings.txt')
593-
for line in game_strings.split('\r\n'):
594-
parts = line.split('=')
595-
if parts[0] == 'DocInfo/Name':
596-
self.name = parts[1]
597-
elif parts[0] == 'DocInfo/Author':
598-
self.author = parts[1]
599-
elif parts[0] == 'DocInfo/DescLong':
600-
self.description = parts[1]
596+
if game_strings:
597+
for line in game_strings.split('\r\n'):
598+
parts = line.split('=')
599+
if parts[0] == 'DocInfo/Name':
600+
self.name = parts[1]
601+
elif parts[0] == 'DocInfo/Author':
602+
self.author = parts[1]
603+
elif parts[0] == 'DocInfo/DescLong':
604+
self.description = parts[1]
601605

602606
@classmethod
603607
def get_url(cls, gateway, map_hash):

0 commit comments

Comments
 (0)