diff options
author | Andrzej Bieniek <andyhelp@gmail.com> | 2019-03-04 22:32:22 +0000 |
---|---|---|
committer | Andrzej Bieniek <andyhelp@gmail.com> | 2019-03-04 22:44:23 +0000 |
commit | 82c052ceecb59e2023c4b6f336e0db9423529a02 (patch) | |
tree | f1cd28e9acfbce22d0ce6c726b80f69445d972b8 | |
parent | 38a43f816f3f6d106d947235e6034f0babac1192 (diff) |
batteryarc-widget: fix crash when battery is not available
It was crashing awesome window manager when starting with battery removed from the laptop.
-rw-r--r-- | batteryarc-widget/batteryarc.lua | 4 |
1 files changed, 3 insertions, 1 deletions
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 |