Skip to content

Commit

Permalink
Catch ZeroDivisionError in ACPL calculation
Browse files Browse the repository at this point in the history
Closes #29
  • Loading branch information
rpdelaney committed Aug 25, 2019
1 parent 00961cf commit 6caa559
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion annotator/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,10 @@ def acpl(cpl_list):
Average Centipawn Loss
Takes a list of integers and returns an average of the list contents
"""
return sum(cpl_list) / len(cpl_list)
try:
return sum(cpl_list) / len(cpl_list)
except ZeroDivisionError:
return 0


def clean_game(game):
Expand Down

0 comments on commit 6caa559

Please sign in to comment.