From 4cb67c0d794144fc5b1d481576623aebbf601e74 Mon Sep 17 00:00:00 2001 From: Roz K Date: Tue, 3 Jan 2023 14:10:04 +0100 Subject: [PATCH] Fix perf node division by zero. --- game/game.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/game/game.py b/game/game.py index 37ea92e..2c21dc0 100644 --- a/game/game.py +++ b/game/game.py @@ -56,9 +56,10 @@ class PerfGroup(Group): self._name = name def __del__(self): - avg = round(self._total / self._count, 2) - print(self._name, "*", self._count, - ": min =", round(self._min, 2), ", max =", round(self._max, 2), ", avg =", avg, "(ms)") + if self._count: + avg = round(self._total / self._count, 2) + print(self._name, "*", self._count, + ": min =", round(self._min, 2), ", max =", round(self._max, 2), ", avg =", avg, "(ms)") def draw(self, time): begin = thread_time()