From 2c9cbc9f58cd167ba6a77932a57f50ca219b60a8 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 (cherry picked from commit 15780364cf13de0bd4c2a40d895fe77273f00ab9) --- 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 f399d940..9fa3e705 100644 --- a/src/windows.py +++ b/src/windows.py @@ -135,7 +135,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