Return from GenerateContent() if m_pObjHolder->GetFormDict() is null.

Currently this case will lead to a crash, as pContent will be null
and pPageDict will be dereferenced.

This is a theoritical case, there is no concrete test case.

Change-Id: Ieedab26cd9f419ab49aa2cde15f1b8e3c230b61d
Reviewed-on: https://pdfium-review.googlesource.com/34430
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
index 107f54e..6c284e1 100644
--- a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
+++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
@@ -82,8 +82,10 @@
 
   // 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) {