Browse Source

battery_remaining: check for division by zero

master
Aaron Marcher 8 years ago
parent
commit
aa8654795d
  1. 4
      components/battery.c

4
components/battery.c

@ -107,6 +107,10 @@
return NULL; return NULL;
} }
if (current_now == 0) {
return NULL;
}
timeleft = (double)charge_now / (double)current_now; timeleft = (double)charge_now / (double)current_now;
h = timeleft; h = timeleft;
m = (timeleft - (double)h) * 60; m = (timeleft - (double)h) * 60;

Loading…
Cancel
Save