summaryrefslogtreecommitdiff
path: root/core/fpdfapi/page/cpdf_docpagedata.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2017-04-26 15:22:00 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-04-27 23:22:12 +0000
commit66568bcd683dd7b18672cb3aebca4487e9203519 (patch)
tree7297841771a796bafd3d0d17dd47b7b0e394d933 /core/fpdfapi/page/cpdf_docpagedata.cpp
parentba817506edcb26e0acf497111e7684e39dadaf04 (diff)
downloadpdfium-66568bcd683dd7b18672cb3aebca4487e9203519.tar.xz
Assert CPDF_Pattern always has a valid CPDF_Document pointer.
Same for CPDF_DocPageData. Change-Id: I8f2f559123dbb2f3623d957e4074d5f9d191797f Reviewed-on: https://pdfium-review.googlesource.com/4501 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fpdfapi/page/cpdf_docpagedata.cpp')
-rw-r--r--core/fpdfapi/page/cpdf_docpagedata.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/core/fpdfapi/page/cpdf_docpagedata.cpp b/core/fpdfapi/page/cpdf_docpagedata.cpp
index 5e13740c21..58e81559ea 100644
--- a/core/fpdfapi/page/cpdf_docpagedata.cpp
+++ b/core/fpdfapi/page/cpdf_docpagedata.cpp
@@ -28,7 +28,9 @@
#include "third_party/base/stl_util.h"
CPDF_DocPageData::CPDF_DocPageData(CPDF_Document* pPDFDoc)
- : m_pPDFDoc(pPDFDoc), m_bForceClear(false) {}
+ : m_pPDFDoc(pPDFDoc), m_bForceClear(false) {
+ assert(m_pPDFDoc);
+}
CPDF_DocPageData::~CPDF_DocPageData() {
Clear(false);
@@ -330,7 +332,7 @@ CPDF_Pattern* CPDF_DocPageData::GetPattern(CPDF_Object* pPatternObj,
pPattern = pdfium::MakeUnique<CPDF_ShadingPattern>(m_pPDFDoc, pPatternObj,
true, matrix);
} else {
- CPDF_Dictionary* pDict = pPatternObj ? pPatternObj->GetDict() : nullptr;
+ CPDF_Dictionary* pDict = pPatternObj->GetDict();
if (pDict) {
int type = pDict->GetIntegerFor("PatternType");
if (type == CPDF_Pattern::TILING) {