From 30f857246e9cea6c1879d52801dcb24c75b45d42 Mon Sep 17 00:00:00 2001 From: Samuel Mehrbrodt Date: Mon, 10 Jul 2017 10:26:40 +0200 Subject: Related tdf#108977 Fix crash when vieweing non-existing certificate gpg4libre Change-Id: If72c2ee818b67b48753ee293de4f02b4832b9d96 Reviewed-on: https://gerrit.libreoffice.org/39743 Reviewed-by: Thorsten Behrens Tested-by: Thorsten Behrens --- xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx | 6 +++++- xmlsecurity/source/dialogs/digitalsignaturesdialog.hrc | 1 + xmlsecurity/source/dialogs/digitalsignaturesdialog.src | 5 +++++ 3 files changed, 11 insertions(+), 1 deletion(-) (limited to 'xmlsecurity') diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx index 37d0608d66c7..69a9a7d4ec60 100644 --- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx +++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx @@ -724,13 +724,17 @@ void DigitalSignaturesDialog::ImplShowSignaturesDetails() sal_uInt16 nSelected = (sal_uInt16) reinterpret_cast( m_pSignaturesLB->FirstSelected()->GetUserData() ); const SignatureInformation& rInfo = maSignatureManager.maCurrentSignatureInformations[ nSelected ]; uno::Reference xCert = getCertificate(rInfo); - uno::Reference xSecEnv = getSecurityEnvironmentForCertificate(xCert); if ( xCert.is() ) { + uno::Reference xSecEnv = getSecurityEnvironmentForCertificate(xCert); ScopedVclPtrInstance aViewer(this, xSecEnv, xCert, false); aViewer->Execute(); } + else + { + ScopedVclPtrInstance(nullptr, XsResId(STR_XMLSECDLG_NO_CERT_FOUND))->Execute(); + } } } diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.hrc b/xmlsecurity/source/dialogs/digitalsignaturesdialog.hrc index 4998defb3238..c56c26da96d1 100644 --- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.hrc +++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.hrc @@ -28,6 +28,7 @@ #define STR_XMLSECDLG_QUERY_REALLYREMOVE (RID_DIGITALSIGNATUREDLG_START + 2) #define STR_XMLSECDLG_SIGNING_FAILED (RID_DIGITALSIGNATUREDLG_START + 3) #define STR_XMLSECDLG_NO_CERT_MANAGER (RID_DIGITALSIGNATUREDLG_START + 4) +#define STR_XMLSECDLG_NO_CERT_FOUND (RID_DIGITALSIGNATUREDLG_START + 5) #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.src b/xmlsecurity/source/dialogs/digitalsignaturesdialog.src index 2d4b4e0fb38e..a01f7d1a33b6 100644 --- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.src +++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.src @@ -51,4 +51,9 @@ String STR_XMLSECDLG_NO_CERT_MANAGER Text [ en-US ] = "Could not find any certificate manager."; }; +String STR_XMLSECDLG_NO_CERT_FOUND +{ + Text [ en-US ] = "Could not find the certificate."; +}; + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit