summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2017-12-19 18:12:13 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-12-19 18:12:13 +0000
commitfbec801a8dd8ac30dc2f08385deb0ac81031f3f5 (patch)
treeffbddd1414e6f36a507c57b6cbdca9603d83a638 /core
parent360edebb1889e16d5084f2a3081ffdcfc0f60efa (diff)
downloadpdfium-fbec801a8dd8ac30dc2f08385deb0ac81031f3f5.tar.xz
Change pattern creation checks in CPDF_DocPageData::GetPattern().
Do them in the right places, instead of having a catch-all at the end. Change-Id: Ie26f06dbd1c50d5b5bf57aa1f9993d5d19f74c02 Reviewed-on: https://pdfium-review.googlesource.com/21670 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core')
-rw-r--r--core/fpdfapi/page/cpdf_docpagedata.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/core/fpdfapi/page/cpdf_docpagedata.cpp b/core/fpdfapi/page/cpdf_docpagedata.cpp
index dc2554f92d..0d2a9189b6 100644
--- a/core/fpdfapi/page/cpdf_docpagedata.cpp
+++ b/core/fpdfapi/page/cpdf_docpagedata.cpp
@@ -346,19 +346,20 @@ CPDF_Pattern* CPDF_DocPageData::GetPattern(CPDF_Object* pPatternObj,
m_pPDFDoc.Get(), pPatternObj, true, matrix);
} else {
CPDF_Dictionary* pDict = pPatternObj->GetDict();
- if (pDict) {
- int type = pDict->GetIntegerFor("PatternType");
- if (type == CPDF_Pattern::TILING) {
- pPattern = pdfium::MakeUnique<CPDF_TilingPattern>(m_pPDFDoc.Get(),
- pPatternObj, matrix);
- } else if (type == CPDF_Pattern::SHADING) {
- pPattern = pdfium::MakeUnique<CPDF_ShadingPattern>(
- m_pPDFDoc.Get(), pPatternObj, false, matrix);
- }
+ if (!pDict)
+ return nullptr;
+
+ int type = pDict->GetIntegerFor("PatternType");
+ if (type == CPDF_Pattern::TILING) {
+ pPattern = pdfium::MakeUnique<CPDF_TilingPattern>(m_pPDFDoc.Get(),
+ pPatternObj, matrix);
+ } else if (type == CPDF_Pattern::SHADING) {
+ pPattern = pdfium::MakeUnique<CPDF_ShadingPattern>(
+ m_pPDFDoc.Get(), pPatternObj, false, matrix);
+ } else {
+ return nullptr;
}
}
- if (!pPattern)
- return nullptr;
if (ptData) {
ptData->reset(std::move(pPattern));