Skip to content

Commit 92ed828

Browse files
committed
Support players not having a played race.
Some custom maps (I'm looking at you 1v1 Obs of the Day) seem to give players None for race type attribute in game. Map that missing race to a python None variable instead of crashing with a KeyError.
1 parent 4fa036f commit 92ed828

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sc2reader/resources.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -965,7 +965,7 @@ def load_players(self):
965965
self.observers.append(player)
966966
continue
967967

968-
player.play_race = RACE_CODES[struct[2]]
968+
player.play_race = RACE_CODES.get(struct[2], None)
969969

970970
player.is_winner = isinstance(struct[1],dict) and struct[1][0] == 0
971971
if player.is_winner:

0 commit comments

Comments
 (0)