Fix issue 442: do not overflow when processing buggy battery input

git-svn-id: http://tint2.googlecode.com/svn/trunk@682 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
o9000 2015-02-01 23:42:05 +00:00 committed by mrovi9000@gmail.com
parent f0e2e72efc
commit 1272ce4bb9

View file

@ -387,7 +387,7 @@ void update_battery() {
battery_state.time.seconds = seconds;
if(energy_full > 0)
new_percentage = (energy_now*100)/energy_full;
new_percentage = ((energy_now <= energy_full ? energy_now : energy_full) * 100) / energy_full;
if(battery_low_status > new_percentage && battery_state.state == BATTERY_DISCHARGING && !battery_low_cmd_send) {
tint_exec(battery_low_cmd);