From 50f1567bc889da1a4e417900116ac25872150a58 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Thu, 1 Apr 2010 11:28:21 +0200 Subject: [PATCH] check we have a cached vcard before looking in it. Fixes #5670 --- src/common/helpers.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/common/helpers.py b/src/common/helpers.py index bc2dccf04..1d01a8120 100644 --- a/src/common/helpers.py +++ b/src/common/helpers.py @@ -1342,11 +1342,11 @@ def get_subscription_request_msg(account=None): our_jid = gajim.get_jid_from_account(account) vcard = gajim.connections[account].get_cached_vcard(our_jid) name = '' - if 'N' in vcard: - if 'GIVEN' in vcard['N'] and 'FAMILY' in vcard['N']: - name = vcard['N']['GIVEN'] + ' ' + vcard['N']['FAMILY'] - if not name: - if 'FN' in vcard: + if vcard: + if 'N' in vcard: + if 'GIVEN' in vcard['N'] and 'FAMILY' in vcard['N']: + name = vcard['N']['GIVEN'] + ' ' + vcard['N']['FAMILY'] + if not name and 'FN' in vcard: name = vcard['FN'] nick = gajim.nicks[account] if name and nick: