summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/fpdfapi/parser/cpdf_document.cpp3
-rw-r--r--fpdfsdk/fpdfdoc_embeddertest.cpp7
2 files changed, 10 insertions, 0 deletions
diff --git a/core/fpdfapi/parser/cpdf_document.cpp b/core/fpdfapi/parser/cpdf_document.cpp
index 6a8ddd1e1c..565886a3a5 100644
--- a/core/fpdfapi/parser/cpdf_document.cpp
+++ b/core/fpdfapi/parser/cpdf_document.cpp
@@ -377,6 +377,9 @@ void CPDF_Document::LoadDocInternal() {
}
void CPDF_Document::LoadDocumentInfo() {
+ if (!m_pParser)
+ return;
+
CPDF_Object* pInfoObj = GetOrParseIndirectObject(m_pParser->GetInfoObjNum());
if (pInfoObj)
m_pInfoDict = pInfoObj->GetDict();
diff --git a/fpdfsdk/fpdfdoc_embeddertest.cpp b/fpdfsdk/fpdfdoc_embeddertest.cpp
index 19147d4bae..c691a17a11 100644
--- a/fpdfsdk/fpdfdoc_embeddertest.cpp
+++ b/fpdfsdk/fpdfdoc_embeddertest.cpp
@@ -237,6 +237,13 @@ TEST_F(FPDFDocEmbeddertest, GetMetaTextInAttachmentFile) {
WideString::FromUTF16LE(buf, FXSYS_len(kExpectedModDate)));
}
+TEST_F(FPDFDocEmbeddertest, GetMetaTextFromNewDocument) {
+ FPDF_DOCUMENT empty_doc = FPDF_CreateNewDocument();
+ unsigned short buf[128];
+ EXPECT_EQ(2u, FPDF_GetMetaText(empty_doc, "Title", buf, sizeof(buf)));
+ FPDF_CloseDocument(empty_doc);
+}
+
TEST_F(FPDFDocEmbeddertest, NoPageLabels) {
EXPECT_TRUE(OpenDocument("about_blank.pdf"));
EXPECT_EQ(1, FPDF_GetPageCount(document()));