fixed possible segfault
git-svn-id: http://tint2.googlecode.com/svn/trunk@76 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
parent
88661d034a
commit
466f4fb1db
1 changed files with 2 additions and 1 deletions
|
@ -100,7 +100,8 @@ void update_battery(struct batstate *data) {
|
|||
seconds -= 60 * data->time.minutes;
|
||||
data->time.seconds = seconds;
|
||||
|
||||
new_percentage = (energy_now*100)/energy_full;
|
||||
if(energy_full > 0)
|
||||
new_percentage = (energy_now*100)/energy_full;
|
||||
|
||||
if(battery_low_status != 0 && battery_low_status == new_percentage && data->percentage > new_percentage) {
|
||||
printf("battery low, executing: %s\n", battery_low_cmd);
|
||||
|
|
Loading…
Reference in a new issue