From d236417e36233f4a06bdbe7d2e9526b069ca25aa Mon Sep 17 00:00:00 2001
From: Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com>
Date: Wed, 11 Mar 2015 13:54:47 -0400
Subject: [PATCH] Add missing licence

And fix a nullptr dereference introduced by the last commit
---
 src/securityflaw.h              | 17 +++++++++++++++++
 src/securityvalidationmodel.cpp |  2 +-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/src/securityflaw.h b/src/securityflaw.h
index 0ad95373..80604450 100644
--- a/src/securityflaw.h
+++ b/src/securityflaw.h
@@ -1,3 +1,20 @@
+/****************************************************************************
+ *   Copyright (C) 2015 by Savoir-Faire Linux                               *
+ *   Author : Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> *
+ *                                                                          *
+ *   This library is free software; you can redistribute it and/or          *
+ *   modify it under the terms of the GNU Lesser General Public             *
+ *   License as published by the Free Software Foundation; either           *
+ *   version 2.1 of the License, or (at your option) any later version.     *
+ *                                                                          *
+ *   This library is distributed in the hope that it will be useful,        *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of         *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU      *
+ *   Lesser General Public License for more details.                        *
+ *                                                                          *
+ *   You should have received a copy of the GNU General Public License      *
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.  *
+ ***************************************************************************/
 #ifndef SECURITY_FLAW_H
 #define SECURITY_FLAW_H
 
diff --git a/src/securityvalidationmodel.cpp b/src/securityvalidationmodel.cpp
index 3247b98a..0d3439a3 100644
--- a/src/securityvalidationmodel.cpp
+++ b/src/securityvalidationmodel.cpp
@@ -181,7 +181,7 @@ void SecurityValidationModelPrivate::update()
 
    /* The user certificate need to have a private key, otherwise it wont
     * be possible to encrypt anything */
-   if (( m_pAccount->tlsCertificate()->hasPrivateKey() == Certificate::CheckValues::FAILED) && (m_pAccount->tlsPrivateKeyCertificate()->exist()  == Certificate::CheckValues::FAILED)) {
+   if (( m_pAccount->tlsCertificate() && m_pAccount->tlsCertificate()->hasPrivateKey() == Certificate::CheckValues::FAILED) && (m_pAccount->tlsPrivateKeyCertificate() && m_pAccount->tlsPrivateKeyCertificate()->exist()  == Certificate::CheckValues::FAILED)) {
       m_lCurrentFlaws << _F(PRIVATE_KEY_MISSING,m_pAccount->tlsPrivateKeyCertificate()->type());
    }
 
-- 
GitLab