projects
/
suckless
/
slstatus.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a546d4b
)
battery_remaining: check for division by zero
author
Aaron Marcher
<me@drkhsh.at>
Sun, 20 May 2018 22:42:06 +0000
(
00:42
+0200)
committer
Aaron Marcher
<me@drkhsh.at>
Sun, 20 May 2018 22:42:06 +0000
(
00:42
+0200)
components/battery.c
patch
|
blob
|
history
diff --git
a/components/battery.c
b/components/battery.c
index fa525be15b5d035c8a5118c8707d4bde2213bda3..8bfe42a2d2e192de719a92387a74b9f67a066a83 100644
(file)
--- 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;