Skip to content
Snippets Groups Projects
Commit 44420982 authored by Yann Leboulanger's avatar Yann Leboulanger
Browse files

prevent traceback when we fill the roster. fixes #3579

parent 9acde16d
No related branches found
No related tags found
No related merge requests found
......@@ -432,8 +432,19 @@ class Contacts:
contact2 = self.get_contact_with_highest_priority(account2, jid2)
show_list = ['not in roster', 'error', 'offline', 'invisible', 'dnd',
'xa', 'away', 'chat', 'online', 'requested', 'message']
show1 = show_list.index(contact1.show)
show2 = show_list.index(contact2.show)
# contact can be null when we fill the roster on connection
if not contact1:
show1 = 0
priority1 = 0
else:
show1 = show_list.index(contact1.show)
priority1 = contact1.priority
if not contact1:
show2 = 0
priority2 = 0
else:
show2 = show_list.index(contact2.show)
priority2 = contact2.priority
# If only one is offline, it's always second
if show1 > 2 and show2 < 3:
return 1
......@@ -450,9 +461,9 @@ class Contacts:
return 1
if transport1 and not transport2:
return -1
if contact1.priority > contact2.priority:
if priority1 > priority2:
return 1
if contact2.priority > contact1.priority:
if priority2 > priority1:
return -1
if show1 > show2:
return 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment