avoid a crash on invalid colors

This commit is contained in:
Florent Le Coz 2011-11-07 19:54:12 +01:00
parent cd16403cb4
commit 15780364cf

View file

@ -138,7 +138,8 @@ class Win(object):
self._win.attron(curses.A_BOLD)
if attr_char in string.digits and attr_char != '':
color_str = text[next_attr_char+1:text.find('}', next_attr_char)]
self._win.attron(to_curses_attr((int(color_str), -1)))
if color_str:
self._win.attron(to_curses_attr((int(color_str), -1)))
text = text[next_attr_char+len(color_str)+2:]
else:
text = text[next_attr_char+2:]