X-Git-Url: https://git.xinqibao.xyz/slstatus.git/blobdiff_plain/a546d4b585234f66b82e048c2d7cb228b9e7fea4..005b5417179de9eff56a9ac5f2ed818ae9ad5817:/components/battery.c?ds=inline diff --git a/components/battery.c b/components/battery.c index fa525be..99e09d5 100644 --- a/components/battery.c +++ b/components/battery.c @@ -1,5 +1,4 @@ /* See LICENSE file for copyright and license details. */ -#include #include #include @@ -107,6 +106,10 @@ return NULL; } + if (current_now == 0) { + return NULL; + } + timeleft = (double)charge_now / (double)current_now; h = timeleft; m = (timeleft - (double)h) * 60;