summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
index 107f54efdb..6c284e1d27 100644
--- a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
+++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
@@ -82,8 +82,10 @@ void CPDF_PageContentGenerator::GenerateContent() {
// Add buffer to a stream in page's 'Contents'
CPDF_Dictionary* pPageDict = m_pObjHolder->GetFormDict();
- CPDF_Object* pContent =
- pPageDict ? pPageDict->GetObjectFor("Contents") : nullptr;
+ if (!pPageDict)
+ return;
+
+ CPDF_Object* pContent = pPageDict->GetObjectFor("Contents");
CPDF_Stream* pStream = pDoc->NewIndirect<CPDF_Stream>();
pStream->SetData(&buf);
if (pContent) {