changeset 407:364d2c8eb476

core (common): Don't crash JidSelector when data for entity is missing from cache
author Goffi <goffi@goffi.org>
date Wed, 19 Feb 2020 09:49:19 +0100
parents 03554ad70846
children 355326a3501c
files cagou/core/common.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/cagou/core/common.py	Wed Feb 12 20:02:58 2020 +0100
+++ b/cagou/core/common.py	Wed Feb 19 09:49:19 2020 +0100
@@ -325,7 +325,11 @@
     def getItemFromWid(self, wid):
         """create JidSelector item from QuickChat widget"""
         contact_list = G.host.contact_lists[wid.profile]
-        data=contact_list.getItem(wid.target)
+        try:
+            data=contact_list.getItem(wid.target)
+        except KeyError:
+            log.warning(f"Can't find item data for {wid.target}")
+            data={}
         try:
             item = self._createItem(
                 jid=wid.target,