Xinqi Bao's Git

temperature: Improve types
[slstatus.git] / components / battery.c
index fa525be..99e09d5 100644 (file)
@@ -1,5 +1,4 @@
 /* See LICENSE file for copyright and license details. */
-#include <errno.h>
 #include <stdio.h>
 #include <string.h>
 
                                return NULL;
                        }
 
+                       if (current_now == 0) {
+                               return NULL;
+                       }
+
                        timeleft = (double)charge_now / (double)current_now;
                        h = timeleft;
                        m = (timeleft - (double)h) * 60;