Do not traceback when receiving malformed XML in a xhtml-im body

This commit is contained in:
Florent Le Coz 2013-06-06 22:53:43 +02:00
parent 9e8860cd6a
commit 834546ac77

View file

@ -227,7 +227,11 @@ def ncurses_color_to_html(color):
def xhtml_to_poezio_colors(xml): def xhtml_to_poezio_colors(xml):
if isinstance(xml, str): if isinstance(xml, str):
try:
xml = ET.fromstring(xml) xml = ET.fromstring(xml)
except cElementTree.ParserError as e:
log.error("Error decoding XML: [%s] (%s)" % (xml, e))
return ""
def parse_css(css): def parse_css(css):
def get_color(value): def get_color(value):
if value[0] == '#': if value[0] == '#':