From 15780364cf13de0bd4c2a40d895fe77273f00ab9 Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Mon, 7 Nov 2011 19:54:12 +0100 Subject: avoid a crash on invalid colors --- src/windows.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/windows.py b/src/windows.py index 790dd858..1ff8f858 100644 --- a/src/windows.py +++ b/src/windows.py @@ -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:] -- cgit v1.2.3