Sfoglia il codice sorgente

battery_remaining: check for division by zero

master
Aaron Marcher 6 anni fa
parent
commit
aa8654795d
1 ha cambiato i file con 4 aggiunte e 0 eliminazioni
  1. +4
    -0
      components/battery.c

+ 4
- 0
components/battery.c Vedi File

@@ -107,6 +107,10 @@
return NULL;
}

if (current_now == 0) {
return NULL;
}

timeleft = (double)charge_now / (double)current_now;
h = timeleft;
m = (timeleft - (double)h) * 60;


Caricamento…
Annulla
Salva