Try/catch for issue #356

This commit is contained in:
Nicolargo 2014-05-27 16:50:43 +02:00
parent 2c57f019f1
commit 4c78d5f15e
2 changed files with 5 additions and 2 deletions

View File

@ -19,7 +19,7 @@
# Glances informations
__appname__ = 'glances'
__version__ = '2.0_RC1'
__version__ = '2.0_RC2'
__author__ = 'Nicolas Hennion <nicolas@nicolargo.com>'
__license__ = 'LGPL'

View File

@ -133,7 +133,10 @@ class Plugin(GlancesPlugin):
ret.append(self.curse_add_line(msg))
msg = "{0:>5}".format(item['value'])
if item['type'] == 'battery':
ret.append(self.curse_add_line(msg, self.get_alert(100 - item['value'], header=item['type'])))
try:
ret.append(self.curse_add_line(msg, self.get_alert(100 - item['value'], header=item['type'])))
except TypeError:
pass
else:
ret.append(self.curse_add_line(msg, self.get_alert(item['value'], header=item['type'])))