From 03c2d2974a613e42cd1634fcea7d5eede282cded Mon Sep 17 00:00:00 2001 From: mathieui Date: Thu, 21 May 2015 14:29:26 +0200 Subject: Handle not-well-formed XML in the XML tab buffer happens with whitespace keepalive at least --- src/tabs/xmltab.py | 7 +++++-- 1 file 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() -- cgit v1.2.3