Catch potential division by zero
This commit is contained in:
parent
59491b7486
commit
57a22816a2
1 changed files with 4 additions and 1 deletions
|
@ -53,7 +53,10 @@ def average_mood(context, start, end=None):
|
|||
for status in status_list:
|
||||
moods.append(status.mood.value)
|
||||
|
||||
average = sum(moods) / len(moods)
|
||||
try:
|
||||
average = sum(moods) / len(moods)
|
||||
except ZeroDivisionError:
|
||||
average = None
|
||||
|
||||
return average
|
||||
|
||||
|
|
Loading…
Reference in a new issue