From 994f439cfddc91c298339ef9983d43d1cd5dcc9b Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee <elv1313@gmail.com> Date: Fri, 28 Apr 2017 05:28:22 -0400 Subject: [PATCH] contactmethod: Potential null dereference. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Should not happen, but is technically possible. Change-Id: Icfc4015267fd5d023e45f558f07e974a380b2859 Reviewed-by: Nicolas Jäger <nicolas.jager@savoirfairelinux.com> --- src/contactmethod.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/contactmethod.cpp b/src/contactmethod.cpp index 0d479902..28f0656b 100644 --- a/src/contactmethod.cpp +++ b/src/contactmethod.cpp @@ -222,7 +222,8 @@ void ContactMethod::setPerson(Person* contact) //The sha1 is no longer valid d_ptr->m_Sha1.clear(); - contact->d_ptr->registerContactMethod(this); + if (contact) + contact->d_ptr->registerContactMethod(this); if (contact && d_ptr->m_Type != ContactMethod::Type::TEMPORARY) { PhoneDirectoryModel::instance().d_ptr->indexNumber(this,d_ptr->m_hNames.keys()+QStringList(contact->formattedName())); -- GitLab