handle division by zero with no swap

Reported by Stefan Praszalowicz
This commit is contained in:
Matt Mackall 2013-05-08 14:21:28 -05:00
commit 02bda05e5b

2
smem
View file

@ -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