Xinqi Bao's Git

swap_perc: check for division by zero on obsd too
[slstatus.git] / components / swap.c
index 465ffd4..f5db667 100644 (file)
 
                getstats(&total, &used);
 
+               if (total == 0) {
+                       return NULL;
+               }
+
                return bprintf("%d%%", 100 * used / total);
        }