Handle not-well-formed XML in the XML tab buffer

happens with whitespace keepalive at least
This commit is contained in:
mathieui 2015-05-21 14:29:26 +02:00
parent 927822cb46
commit 03c2d2974a
No known key found for this signature in database
GPG key ID: C59F84CEEFD616E3

View file

@ -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()