summaryrefslogtreecommitdiff
path: root/src/xhtml.py
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2013-06-06 22:53:43 +0200
committerFlorent Le Coz <louiz@louiz.org>2013-06-06 22:53:43 +0200
commit834546ac7752e3e5c65d31e900489df2c85ce298 (patch)
treed5f5e9ff5e0c883a462b05cd7446aec51b099282 /src/xhtml.py
parent9e8860cd6abae3c41af085fc940853653f1ee9d6 (diff)
downloadpoezio-834546ac7752e3e5c65d31e900489df2c85ce298.tar.gz
poezio-834546ac7752e3e5c65d31e900489df2c85ce298.tar.bz2
poezio-834546ac7752e3e5c65d31e900489df2c85ce298.tar.xz
poezio-834546ac7752e3e5c65d31e900489df2c85ce298.zip
Do not traceback when receiving malformed XML in a xhtml-im body
Diffstat (limited to 'src/xhtml.py')
-rw-r--r--src/xhtml.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/xhtml.py b/src/xhtml.py
index 1deca67a..e34ea3e7 100644
--- a/src/xhtml.py
+++ b/src/xhtml.py
@@ -227,7 +227,11 @@ def ncurses_color_to_html(color):
def xhtml_to_poezio_colors(xml):
if isinstance(xml, str):
- xml = ET.fromstring(xml)
+ try:
+ xml = ET.fromstring(xml)
+ except cElementTree.ParserError as e:
+ log.error("Error decoding XML: [%s] (%s)" % (xml, e))
+ return ""
def parse_css(css):
def get_color(value):
if value[0] == '#':