Merge pull request #1729 from thomwiggers/fix-divide-bat-by-zero
Prevent divide by zero battery capacity
This commit is contained in:
commit
4c68f773aa
|
@ -72,7 +72,10 @@ def _fetch_battery_info(pl):
|
|||
devtype_name,
|
||||
'State'
|
||||
) != 2
|
||||
return (energy * 100.0 / energy_full), state
|
||||
if energy_full > 0:
|
||||
return (energy * 100.0 / energy_full), state
|
||||
else:
|
||||
return 0.0, state
|
||||
return _flatten_battery
|
||||
pl.debug('Not using DBUS+UPower as no batteries were found')
|
||||
|
||||
|
|
Loading…
Reference in New Issue