prevent traceback when there is a row in roster without an associated Contact instance. see #3718

This commit is contained in:
Yann Leboulanger 2008-03-10 15:41:06 +00:00
parent 244d222b82
commit 3f98f9c53b
1 changed files with 2 additions and 2 deletions

View File

@ -261,14 +261,14 @@ class RosterWindow:
showOffline = gajim.config.get('showoffline') showOffline = gajim.config.get('showoffline')
model = self.tree.get_model() model = self.tree.get_model()
contact = gajim.contacts.get_first_contact_from_jid(account, jid) contact = gajim.contacts.get_first_contact_from_jid(account, jid)
if not contact:
return
nb_events = gajim.events.get_nb_roster_events(account, contact.jid) nb_events = gajim.events.get_nb_roster_events(account, contact.jid)
# count events from all resources # count events from all resources
for contact_ in gajim.contacts.get_contacts(account, jid): for contact_ in gajim.contacts.get_contacts(account, jid):
if contact_.resource: if contact_.resource:
nb_events += gajim.events.get_nb_roster_events(account, nb_events += gajim.events.get_nb_roster_events(account,
contact_.get_full_jid()) contact_.get_full_jid())
if not contact:
return
# If contact already in roster, do not add it # If contact already in roster, do not add it
if len(self.get_contact_iter(jid, account)): if len(self.get_contact_iter(jid, account)):
return return