diff --git a/i3pystatus/cpu_usage.py b/i3pystatus/cpu_usage.py index a1f8e82..57e2083 100644 --- a/i3pystatus/cpu_usage.py +++ b/i3pystatus/cpu_usage.py @@ -67,7 +67,10 @@ class CpuUsage(IntervalModule): self.prev_total[cpu] = total self.prev_busy[cpu] = busy - return int(diff_busy / diff_total * 100) + if diff_total == 0: + return 0 + else: + return int(diff_busy / diff_total * 100) def gen_format_all(self, usage): """