batteryarc-widget: fix crash when battery is not available

It was crashing awesome window manager when starting with battery removed from the laptop.
This commit is contained in:
Andrzej Bieniek 2019-03-04 22:32:22 +00:00
parent 38a43f816f
commit 82c052ceec
1 changed files with 3 additions and 1 deletions

View File

@ -75,7 +75,9 @@ watch("acpi -i", 10,
charge = charge + batt.charge * capacities[i] charge = charge + batt.charge * capacities[i]
end end
if capacity > 0 then
charge = charge / capacity charge = charge / capacity
end
widget.value = charge / 100 widget.value = charge / 100
if status == 'Charging' then if status == 'Charging' then