diff --git a/xmlsecurity/source/pdfio/pdfdocument.cxx b/xmlsecurity/source/pdfio/pdfdocument.cxx index 0bc2f80d6798..cd52f8d0eaac 100644 --- a/xmlsecurity/source/pdfio/pdfdocument.cxx +++ b/xmlsecurity/source/pdfio/pdfdocument.cxx @@ -478,6 +478,11 @@ bool PDFDocument::Sign(const uno::Reference& xCertificat m_aEditBuffer.WriteCharPtr("\nendobj\n\n"); // Write the updated Catalog object, references nAnnotId. + if (!m_pTrailer) + { + SAL_WARN("xmlsecurity.pdfio", "PDFDocument::Sign: found no trailer"); + return false; + } auto pRoot = dynamic_cast(m_pTrailer->Lookup("Root")); if (!pRoot) {