From d040cc13fc70592531f3634b49158b9100c169fb Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Thu, 20 Apr 2006 16:57:43 +0000 Subject: [PATCH] be sure chat_control.contact is never None, even when server connection is brocken. Fixes #1878 --- src/chat_control.py | 8 +++++--- src/common/contacts.py | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/chat_control.py b/src/chat_control.py index 03b01244a..ded91bd4b 100644 --- a/src/chat_control.py +++ b/src/chat_control.py @@ -1618,8 +1618,10 @@ class ChatControl(ChatControlBase): def got_connected(self): ChatControlBase.got_connected(self) # Refreshing contact - self.contact = gajim.contacts.get_contact_with_highest_priority( + contact = gajim.contacts.get_contact_with_highest_priority( self.account, self.contact.jid) - if isinstance(self.contact, GC_Contact): - self.contact = gajim.contacts.contact_from_gc_contact(self.contact) + if isinstance(contact, GC_Contact): + contact = gajim.contacts.contact_from_gc_contact(contact) + if contact: + self.contact = contact self.draw_banner() diff --git a/src/common/contacts.py b/src/common/contacts.py index 924f3df08..3826cec72 100644 --- a/src/common/contacts.py +++ b/src/common/contacts.py @@ -212,7 +212,7 @@ class Contacts: # jid may be a fake jid, try it room, nick = jid.split('/') contact = self.get_gc_contact(account, room, nick) - return contact or [] + return contact return self.get_highest_prio_contact_from_contacts(contacts) def get_first_contact_from_jid(self, account, jid):