summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2012-10-09 17:41:17 -0400
committerJason R. Coombs <jaraco@jaraco.com>2012-10-09 17:41:17 -0400
commit1f4a5bd42cefa816d8ec9c1b7c60b6255150da0e (patch)
treefe90b4bfa5356c7536e192091d0a77539d4e4beb
parent438a0785fb47fc1ba9fe9421ed47cc9defb15922 (diff)
downloadlogbot-1f4a5bd42cefa816d8ec9c1b7c60b6255150da0e.tar.xz
Fix possible KeyError if code is not a color code
-rwxr-xr-xlogbot.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/logbot.py b/logbot.py
index b7cc694..3bc5dd1 100755
--- a/logbot.py
+++ b/logbot.py
@@ -198,6 +198,8 @@ def replace_color(code, text):
'36': '00aaaa',
'37': 'F5F1DE',
}
+ if code not in colors:
+ return text
return '<span style="color: #%(color)s">%(text)s</span>' % dict(
color = colors[code],
text = text,