From c0e4cea37e0912ae361db72d1683dd796df22ea6 Mon Sep 17 00:00:00 2001
From: atraczyk <andreastraczyk@gmail.com>
Date: Thu, 27 Oct 2016 13:37:57 -0400
Subject: [PATCH] nullptr check on allowed_, empty ringtone file

Change-Id: I8759f9c4925325c8456f6ed3c48c8164aee058e1
---
 src/manager.cpp                 | 3 +--
 src/media/audio/tonecontrol.cpp | 3 +++
 src/security/certstore.cpp      | 2 +-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/manager.cpp b/src/manager.cpp
index 00e2362772..f5dd8dc0e3 100644
--- a/src/manager.cpp
+++ b/src/manager.cpp
@@ -1939,8 +1939,7 @@ Manager::playRingtone(const std::string& accountID)
         ringchoice = std::string(PROGSHAREDIR) + DIR_SEPARATOR_STR
                      + RINGDIR + DIR_SEPARATOR_STR + ringchoice;
 #else
-        ringchoice = std::string("") + DIR_SEPARATOR_STR
-                     + RINGDIR + DIR_SEPARATOR_STR + ringchoice;
+        ringchoice = std::string("");
 #endif
     }
 
diff --git a/src/media/audio/tonecontrol.cpp b/src/media/audio/tonecontrol.cpp
index 2f682d5d94..ede7a491bb 100644
--- a/src/media/audio/tonecontrol.cpp
+++ b/src/media/audio/tonecontrol.cpp
@@ -70,6 +70,9 @@ ToneControl::getTelephoneFile(void)
 bool
 ToneControl::setAudioFile(const std::string& file)
 {
+    if (file.empty())
+        return false;
+
     std::lock_guard<std::mutex> lk(mutex_);
 
     if (audioFile_) {
diff --git a/src/security/certstore.cpp b/src/security/certstore.cpp
index 2f70c7b5d8..6b7dfc42a2 100644
--- a/src/security/certstore.cpp
+++ b/src/security/certstore.cpp
@@ -564,7 +564,7 @@ TrustStore::updateKnownCerts()
 void
 TrustStore::setStoreCertStatus(const crypto::Certificate& crt, TrustStore::PermissionStatus status)
 {
-    if (not crt.isCA())
+    if (not crt.isCA() || not allowed_)
         return;
 
     if (status == PermissionStatus::ALLOWED)
-- 
GitLab