From 82c052ceecb59e2023c4b6f336e0db9423529a02 Mon Sep 17 00:00:00 2001 From: Andrzej Bieniek Date: Mon, 4 Mar 2019 22:32:22 +0000 Subject: [PATCH] batteryarc-widget: fix crash when battery is not available It was crashing awesome window manager when starting with battery removed from the laptop. --- batteryarc-widget/batteryarc.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/batteryarc-widget/batteryarc.lua b/batteryarc-widget/batteryarc.lua index a8e5250..1727ee1 100644 --- a/batteryarc-widget/batteryarc.lua +++ b/batteryarc-widget/batteryarc.lua @@ -75,7 +75,9 @@ watch("acpi -i", 10, charge = charge + batt.charge * capacities[i] end - charge = charge / capacity + if capacity > 0 then + charge = charge / capacity + end widget.value = charge / 100 if status == 'Charging' then