quick frontend(contact_list): avoid crash when resource in cache has not priority
This commit is contained in:
parent
61a68ca0ca
commit
95f77b1df1
1 changed files with 3 additions and 1 deletions
|
|
@ -501,7 +501,9 @@ class ProfileContactList(object):
|
|||
resource_data[C.PRESENCE_STATUSES] = statuses
|
||||
|
||||
if entity.bare not in self._specials:
|
||||
priority_resource = max(resources_data, key=lambda res: resources_data[res][C.PRESENCE_PRIORITY])
|
||||
# we may have resources with no priority
|
||||
# (when a cached value is added for a not connected resource)
|
||||
priority_resource = max(resources_data, key=lambda res: resources_data[res].get(C.PRESENCE_PRIORITY, -2**32))
|
||||
cache[C.CONTACT_MAIN_RESOURCE] = priority_resource
|
||||
self.update([entity], C.UPDATE_MODIFY, self.profile)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue