summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
Diffstat (limited to 'components')
-rw-r--r--components/swap.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/components/swap.c b/components/swap.c
index 465ffd4..f5db667 100644
--- a/components/swap.c
+++ b/components/swap.c
@@ -188,6 +188,10 @@
getstats(&total, &used);
+ if (total == 0) {
+ return NULL;
+ }
+
return bprintf("%d%%", 100 * used / total);
}