ConnectionManager: allow self-signed certificate

Change-Id: I10999a2126a6ee0ed1fbc0d9edcef963a6e6c261
diff --git a/src/connectionmanager.cpp b/src/connectionmanager.cpp
index 7243f53..70d48e4 100644
--- a/src/connectionmanager.cpp
+++ b/src/connectionmanager.cpp
@@ -1503,11 +1503,11 @@
         top_issuer = top_issuer->issuer;
 
     // Device certificate can't be self-signed
-    if (top_issuer == crt) {
+    /* if (top_issuer == crt) {
         if (logger)
             logger->warn("Found invalid (self-signed) peer device: {}", crt->getLongId());
         return false;
-    }
+    } */
 
     // Check peer certificate chain
     // Trust store with top issuer as the only CA
@@ -1526,12 +1526,14 @@
         return false;
     }
 
-    account_id = crt->issuer->getId();
-    if (logger)
-        logger->warn("Found peer device: {} account:{} CA:{}",
-              crt->getLongId(),
-              account_id,
-              top_issuer->getId());
+    if (auto issuer = crt->issuer) {
+        account_id = issuer->getId();
+        if (logger)
+            logger->warn("Found peer device: {} account:{} CA:{}",
+                crt->getLongId(),
+                account_id,
+                top_issuer->getId());
+    }
     return true;
 }