diff options
Diffstat (limited to 'src/freebsd/btop_collect.cpp')
-rw-r--r-- | src/freebsd/btop_collect.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/freebsd/btop_collect.cpp b/src/freebsd/btop_collect.cpp index b4034c7..29e54bf 100644 --- a/src/freebsd/btop_collect.cpp +++ b/src/freebsd/btop_collect.cpp @@ -771,8 +771,13 @@ namespace Mem { disk.total = vfs.f_blocks * vfs.f_frsize; disk.free = vfs.f_bfree * vfs.f_frsize; disk.used = disk.total - disk.free; - disk.used_percent = round((double)disk.used * 100 / disk.total); - disk.free_percent = 100 - disk.used_percent; + if (disk.total != 0) { + disk.used_percent = round((double)disk.used * 100 / disk.total); + disk.free_percent = 100 - disk.used_percent; + } else { + disk.used_percent = 0; + disk.free_percent = 0; + } } //? Setup disks order in UI and add swap if enabled |