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