X-Git-Url: https://git.xinqibao.xyz/slstatus.git/blobdiff_plain/a546d4b585234f66b82e048c2d7cb228b9e7fea4..cbbf59fd3dde3f7cfbdc9807da5f5f42b664cf49:/components/battery.c diff --git a/components/battery.c b/components/battery.c index fa525be..8bfe42a 100644 --- a/components/battery.c +++ b/components/battery.c @@ -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;