diff --git a/frontends/src/quick_frontend/quick_contact_list.py b/frontends/src/quick_frontend/quick_contact_list.py index 3f0c980d..7c7e27cd 100644 --- a/frontends/src/quick_frontend/quick_contact_list.py +++ b/frontends/src/quick_frontend/quick_contact_list.py @@ -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)