From cb99f49fc7e4a40f87282bfb04bb08bbc967a229 Mon Sep 17 00:00:00 2001
From: Guillaume Roguez <guillaume.roguez@savoirfairelinux.com>
Date: Wed, 21 Jun 2017 23:35:04 -0400
Subject: [PATCH] upnp: fix null ptr access

A part of the patch [1] has been drop during a rebase.
This caused a access to a possible null ptr.

Re-add the null ptr check.

[1] https://gerrit-ring.savoirfairelinux.com/7156

Change-Id: Idfb502cd9b4c5b1e4a020b05120ce0dd21a014cf
---
 src/sip/sipaccount.cpp | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/sip/sipaccount.cpp b/src/sip/sipaccount.cpp
index 9e35fec2a1..f06b1fa29f 100644
--- a/src/sip/sipaccount.cpp
+++ b/src/sip/sipaccount.cpp
@@ -842,9 +842,10 @@ void SIPAccount::doUnregister(std::function<void(bool)> released_cb)
     if (released_cb)
         released_cb(not isIP2IP());
 
-    /* RING_DBG("UPnP: removing port mapping for SIP account."); */
-    upnp_->setIGDListener();
-    upnp_->removeMappings();
+    if (upnpEnabled_) {
+        upnp_->setIGDListener();
+        upnp_->removeMappings();
+    }
 }
 
 void
-- 
GitLab