From 7f7c55e79a0ec40ec3fae5c86568e4c1b6cc37df Mon Sep 17 00:00:00 2001
From: Michael Gratton <mike@vee.net>
Date: Fri, 25 Sep 2020 08:25:34 +1000
Subject: [PATCH 020/124] Application.CertificateManager: Fix critical when no
 GCR trust stores

Ensure GCR store not null before accessing it.
---
 src/client/application/application-certificate-manager.vala | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/client/application/application-certificate-manager.vala b/src/client/application/application-certificate-manager.vala
index ff0e7785..d9e40fcd 100644
--- a/src/client/application/application-certificate-manager.vala
+++ b/src/client/application/application-certificate-manager.vala
@@ -74,8 +74,10 @@ public class Application.CertificateManager : GLib.Object {
         bool has_rw_store = false;
         if (has_uris) {
             Gck.Slot? store = Gcr.pkcs11_get_trust_store_slot();
-            has_rw_store = !store.has_flags(CKF_WRITE_PROTECTED);
-            debug("GCR store is R/W: %s", has_rw_store.to_string());
+            if (store != null) {
+                has_rw_store = !store.has_flags(CKF_WRITE_PROTECTED);
+                debug("GCR store is R/W: %s", has_rw_store.to_string());
+            }
         }
 
         return has_rw_store;
-- 
2.29.2

