aboutsummaryrefslogtreecommitdiffstats
path: root/examples/plugins/mem
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2016-09-28 17:16:49 +0200
committerMattias Andrée <maandree@kth.se>2016-09-28 17:16:49 +0200
commit48a0b5c44bbfd6cb2ab9d0e9afe2aec75e991597 (patch)
treeed6a50cf6d01886466b42014861baf175b6e1a59 /examples/plugins/mem
parentUpdate: the metar resources have moved (diff)
downloadxpybar-48a0b5c44bbfd6cb2ab9d0e9afe2aec75e991597.tar.gz
xpybar-48a0b5c44bbfd6cb2ab9d0e9afe2aec75e991597.tar.bz2
xpybar-48a0b5c44bbfd6cb2ab9d0e9afe2aec75e991597.tar.xz
Fix bound checking
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r--examples/plugins/mem2
1 files changed, 1 insertions, 1 deletions
diff --git a/examples/plugins/mem b/examples/plugins/mem
index 01f7e9c..518b21d 100644
--- a/examples/plugins/mem
+++ b/examples/plugins/mem
@@ -49,7 +49,7 @@ def redraw():
def u(b):
unit = 0
units = ['KB', 'MB', 'GB', 'TB', 'PB', 'EB']
- while (unit < len(units)) and (b >= 1024):
+ while (unit + 1 < len(units)) and (b >= 1024):
b /= 1024
unit += 1
return '%.0f%s' % (b, units[unit])