handle division by zero with no swap
Reported by Stefan Praszalowicz
This commit is contained in:
parent
9e788b26c6
commit
02bda05e5b
1 changed files with 2 additions and 0 deletions
2
smem
2
smem
|
|
@ -222,6 +222,8 @@ def showamount(a, total):
|
||||||
if options.abbreviate:
|
if options.abbreviate:
|
||||||
return units(a * 1024)
|
return units(a * 1024)
|
||||||
elif options.percent:
|
elif options.percent:
|
||||||
|
if total == 0:
|
||||||
|
return 'N/A'
|
||||||
return "%.2f%%" % (100.0 * a / total)
|
return "%.2f%%" % (100.0 * a / total)
|
||||||
return a
|
return a
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue