Avoid crash without GPG

Change-Id: I5489012544fdf736784608b274359ea99f9ffe45
This commit is contained in:
Tor Lillqvist
2017-12-22 15:23:43 +02:00
parent 381398928f
commit 1b73ed91e1

View File

@@ -308,15 +308,18 @@ void SvxGeneralTabPage::InitCryptography()
{ {
xSEInitializer = xml::crypto::GPGSEInitializer::create( comphelper::getProcessComponentContext() ); xSEInitializer = xml::crypto::GPGSEInitializer::create( comphelper::getProcessComponentContext() );
uno::Reference<xml::crypto::XXMLSecurityContext> xSC = xSEInitializer->createSecurityContext( OUString() ); uno::Reference<xml::crypto::XXMLSecurityContext> xSC = xSEInitializer->createSecurityContext( OUString() );
uno::Reference<xml::crypto::XSecurityEnvironment> xSE = xSC->getSecurityEnvironment(); if (xSC.is())
uno::Sequence<uno::Reference<security::XCertificate>> xCertificates = xSE->getPersonalCertificates();
if (xCertificates.hasElements())
{ {
for (auto& xCert : xCertificates) uno::Reference<xml::crypto::XSecurityEnvironment> xSE = xSC->getSecurityEnvironment();
uno::Sequence<uno::Reference<security::XCertificate>> xCertificates = xSE->getPersonalCertificates();
if (xCertificates.hasElements())
{ {
m_pSigningKeyLB->InsertEntry( xCert->getIssuerName()); for (auto& xCert : xCertificates)
m_pEncryptionKeyLB->InsertEntry( xCert->getIssuerName()); {
m_pSigningKeyLB->InsertEntry( xCert->getIssuerName());
m_pEncryptionKeyLB->InsertEntry( xCert->getIssuerName());
}
} }
} }
} }