Skip to content

Commit f967d7b

Browse files
committed
Fixes a bug in the ApmProcessor that was triggered by players with no game actions (partner afk through whole game?)
1 parent 507e326 commit f967d7b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

sc2reader/processors.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,12 @@ def ApmProcessor(replay):
117117

118118
# Average the APM for actual players
119119
for player in replay.players:
120-
if player.type != "Computer":
121-
player.avg_apm /= player.events[-1].second/60.0
120+
if player.events:
121+
event_minutes = player.events[-1].second/60.0
122+
if event_minutes:
123+
player.avg_apm /= event_minutes
124+
else:
125+
player.avg_apm = 0
122126
else:
123127
player.avg_apm = 0
124128

0 commit comments

Comments
 (0)