summaryrefslogtreecommitdiff
path: root/src/tabs
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2015-05-21 14:29:26 +0200
committermathieui <mathieui@mathieui.net>2015-05-21 14:29:26 +0200
commit03c2d2974a613e42cd1634fcea7d5eede282cded (patch)
tree5e64a3b35440311e248080a7296cd585b6d42d24 /src/tabs
parent927822cb46df92c8f9f4643fc2b09de19cd0ff00 (diff)
downloadpoezio-03c2d2974a613e42cd1634fcea7d5eede282cded.tar.gz
poezio-03c2d2974a613e42cd1634fcea7d5eede282cded.tar.bz2
poezio-03c2d2974a613e42cd1634fcea7d5eede282cded.tar.xz
poezio-03c2d2974a613e42cd1634fcea7d5eede282cded.zip
Handle not-well-formed XML in the XML tab buffer
happens with whitespace keepalive at least
Diffstat (limited to 'src/tabs')
-rw-r--r--src/tabs/xmltab.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/tabs/xmltab.py b/src/tabs/xmltab.py
index 6899cd6f..24187605 100644
--- a/src/tabs/xmltab.py
+++ b/src/tabs/xmltab.py
@@ -137,8 +137,11 @@ class XMLTab(Tab):
self.filters.append(matcher)
new_messages = []
for msg in messages:
- if self.match_stanza(ElementBase(ET.fromstring(clean_text(msg.txt)))):
- new_messages.append(msg)
+ try:
+ if msg.txt.strip() and self.match_stanza(ElementBase(ET.fromstring(clean_text(msg.txt)))):
+ new_messages.append(msg)
+ except ET.ParseError:
+ log.debug('Malformed XML : %s', msg.txt, exc_info=True)
self.filtered_buffer.messages = new_messages
self.text_win.rebuild_everything(self.filtered_buffer)
self.gen_filter_repr()