# HG changeset patch # User Goffi # Date 1475408789 -7200 # Node ID e8cb9cc094858a46e32ab45a493d3d1d054920a1 # Parent 2265d9df4cfbec0cd9be6d1079aa5888fb17ec98 quick frontend(contact_list): avoid crash when resource in cache has not priority diff -r 2265d9df4cfb -r e8cb9cc09485 frontends/src/quick_frontend/quick_contact_list.py --- a/frontends/src/quick_frontend/quick_contact_list.py Sun Sep 25 19:18:45 2016 +0200 +++ b/frontends/src/quick_frontend/quick_contact_list.py Sun Oct 02 13:46:29 2016 +0200 @@ -501,7 +501,9 @@ 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)