From 41fe6ed927daa049929c499d0e2c5acb2121f778 Mon Sep 17 00:00:00 2001 From: js Date: Mon, 19 May 2008 17:54:51 +0000 Subject: [PATCH] Better check if msgtxt is not None. --- src/session.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/session.py b/src/session.py index 90afc5276..2726ddd04 100644 --- a/src/session.py +++ b/src/session.py @@ -158,13 +158,14 @@ class ChatControlSession(stanza_session.EncryptedStanzaSession): # We're also here if we just don't support OTR. # Thus, we should strip the tags from plaintext # messages since they look ugly. - msgtxt = msgtxt.replace('\x20\x09\x20\x20\x09' \ - '\x09\x09\x09\x20\x09\x20\x09\x20\x09' \ - '\x20\x20', '') - msgtxt = msgtxt.replace('\x20\x09\x20\x09\x20' \ - '\x20\x09\x20', '') - msgtxt = msgtxt.replace('\x20\x20\x09\x09\x20' \ - '\x20\x09\x20', '') + if msgtxt: + msgtxt = msgtxt.replace('\x20\x09\x20' \ + '\x20\x09\x09\x09\x09\x20\x09' \ + '\x20\x09\x20\x09\x20\x20', '') + msgtxt = msgtxt.replace('\x20\x09\x20' \ + '\x09\x20\x20\x09\x20', '') + msgtxt = msgtxt.replace('\x20\x20\x09' \ + '\x09\x20\x20\x09\x20', '') else: log_type = 'single_msg_recv'