From 29840645e2cb8231040bcbac1b1fe98f494c92c9 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Fri, 22 Dec 2017 15:23:43 +0200 Subject: Avoid crash without GPG Change-Id: I5489012544fdf736784608b274359ea99f9ffe45 (cherry picked from commit 1b73ed91e1cce20b3b552a36d449fb96cc57bf4f) Reviewed-on: https://gerrit.libreoffice.org/46977 Tested-by: Jenkins Reviewed-by: Katarina Behrens --- cui/source/options/optgenrl.cxx | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'cui') diff --git a/cui/source/options/optgenrl.cxx b/cui/source/options/optgenrl.cxx index c25144f04266..0816a8c49821 100644 --- a/cui/source/options/optgenrl.cxx +++ b/cui/source/options/optgenrl.cxx @@ -308,15 +308,18 @@ void SvxGeneralTabPage::InitCryptography() { xSEInitializer = xml::crypto::GPGSEInitializer::create( comphelper::getProcessComponentContext() ); uno::Reference xSC = xSEInitializer->createSecurityContext( OUString() ); - uno::Reference xSE = xSC->getSecurityEnvironment(); - uno::Sequence> xCertificates = xSE->getPersonalCertificates(); - - if (xCertificates.hasElements()) + if (xSC.is()) { - for (auto& xCert : xCertificates) + uno::Reference xSE = xSC->getSecurityEnvironment(); + uno::Sequence> xCertificates = xSE->getPersonalCertificates(); + + if (xCertificates.hasElements()) { - m_pSigningKeyLB->InsertEntry( xCert->getIssuerName()); - m_pEncryptionKeyLB->InsertEntry( xCert->getIssuerName()); + for (auto& xCert : xCertificates) + { + m_pSigningKeyLB->InsertEntry( xCert->getIssuerName()); + m_pEncryptionKeyLB->InsertEntry( xCert->getIssuerName()); + } } } } -- cgit