Merge pull request #71 from andyhelp/master

batteryarc-widget: fix crash when battery is not available
This commit is contained in:
streetturtle 2019-03-05 08:54:51 -05:00 committed by GitHub
commit f24cbb9fa5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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