From d57d2748eb34ce3fa579db0728a0d5c37056ec76 Mon Sep 17 00:00:00 2001
From: Nicolas Jager <nicolas.jager@savoirfairelinux.com>
Date: Mon, 8 May 2017 12:00:36 -0400
Subject: [PATCH] prevent sending ContactRequest with no vCard

bug : the vcard sent was obtained trough a Person object returned by
contact() from a ContactMethod. But this Person may be never set.

fix : now we use the profile to get the vcard to send within the
ContactRequest.

[SS: improve ci msg; use Account's profile, rather than selected profile]

Change-Id: I21ef691e3fdd96a6e504989a1178444c0d4b90ef
Signed-off-by: Stepan Salenikovich <stepan.salenikovich@savoirfairelinux.com>
Reviewed-by: Stepan Salenikovich <stepan.salenikovich@savoirfairelinux.com>
---
 src/account.cpp | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/account.cpp b/src/account.cpp
index 081e5298..b373c7e8 100644
--- a/src/account.cpp
+++ b/src/account.cpp
@@ -1408,9 +1408,7 @@ bool Account::sendContactRequest( Certificate* c )
 
    QByteArray payload;
 
-   if (contactMethod() && contactMethod()->contact()) {
-      payload = contactMethod()->contact()->toVCard();
-   }
+   payload = profile()->person()->toVCard();
 
    ConfigurationManager::instance().sendTrustRequest(id(),c->remoteId(), payload);
 
-- 
GitLab