ram: Check for theoretical division by zero

This commit is contained in:
Aaron Marcher 2018-07-06 23:38:12 +02:00
parent fa7c266e2b
commit ab4f24a612
1 changed files with 4 additions and 0 deletions

View File

@ -36,6 +36,10 @@
return NULL;
}
if (total == 0) {
return NULL;
}
return bprintf("%d", 100 * ((total - free) -
(buffers + cached)) / total);
}