aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--widgets/cpu.lua2
1 files changed, 2 insertions, 0 deletions
diff --git a/widgets/cpu.lua b/widgets/cpu.lua
index 978b5f4..86a3e85 100644
--- a/widgets/cpu.lua
+++ b/widgets/cpu.lua
@@ -61,6 +61,8 @@ local function worker(format)
-- Calculate percentage
local diff_total = total_new - cpu_total[i]
local diff_active = active_new - cpu_active[i]
+
+ if diff_total == 0 then diff_total = 1E-6 end
cpu_usage[i] = math.floor((diff_active / diff_total) * 100)
-- Store totals