From 6f8e97860ad54626c36c3d709387716ad220262f Mon Sep 17 00:00:00 2001 From: souliane Date: Tue, 14 Jul 2015 12:57:07 +0200 Subject: [PATCH] plugin XEP-0054: fixes bug introduced by changeset 1255 (38fb8823cee8) --- src/plugins/plugin_xep_0054.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/plugin_xep_0054.py b/src/plugins/plugin_xep_0054.py index 6a0f02de..8b67fd74 100755 --- a/src/plugins/plugin_xep_0054.py +++ b/src/plugins/plugin_xep_0054.py @@ -242,10 +242,11 @@ class XEP_0054(object): def _VCardEb(self, failure, profile): """Called when something is wrong with registration""" try: - log.warning(_(u"Can't find VCard of %s") % failure.value.stanza['from']) self.host.bridge.actionResult("SUPPRESS", failure.value.stanza['id'], {}, profile) # FIXME: maybe an error message would be better + log.warning(_(u"Can't find VCard of %s") % failure.value.stanza['from']) self.updateCache(jid.JID(failure.value.stanza['from']), "avatar", '', profile) - except AttributeError: # 'ConnectionLost' object has no attribute 'stanza' + except (AttributeError, KeyError): + # 'ConnectionLost' object has no attribute 'stanza' + sometimes 'from' key doesn't exist log.warning(_(u"Can't find VCard: %s") % failure.getErrorMessage()) def _getCard(self, target_s, profile_key=C.PROF_KEY_NONE):