summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstreetturtle <streetturtle@users.noreply.github.com>2019-03-05 08:54:51 -0500
committerGitHub <noreply@github.com>2019-03-05 08:54:51 -0500
commitf24cbb9fa524241caa6b66c7891ad0e7b157e883 (patch)
treef1cd28e9acfbce22d0ce6c726b80f69445d972b8
parent38a43f816f3f6d106d947235e6034f0babac1192 (diff)
parent82c052ceecb59e2023c4b6f336e0db9423529a02 (diff)
Merge pull request #71 from andyhelp/master
batteryarc-widget: fix crash when battery is not available
-rw-r--r--batteryarc-widget/batteryarc.lua4
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