Remove some checks that are never true in patterns code. Change-Id: I8f589c1fa91d140e11d6ee4edd02daa30d224ac3 Reviewed-on: https://pdfium-review.googlesource.com/c/45190 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdfapi/page/cpdf_docpagedata.cpp b/core/fpdfapi/page/cpdf_docpagedata.cpp index 7b62467..eaadc96 100644 --- a/core/fpdfapi/page/cpdf_docpagedata.cpp +++ b/core/fpdfapi/page/cpdf_docpagedata.cpp
@@ -342,8 +342,9 @@ CPDF_Pattern* CPDF_DocPageData::GetPattern(CPDF_Object* pPatternObj, bool bShading, const CFX_Matrix& matrix) { - if (!pPatternObj) - return nullptr; + ASSERT(pPatternObj); + ASSERT(pPatternObj->IsDictionary() || pPatternObj->IsStream()); + ASSERT(pPatternObj->GetDict()); CPDF_CountedPattern* ptData = nullptr; auto it = m_PatternMap.find(pPatternObj); @@ -359,9 +360,6 @@ m_pPDFDoc.Get(), pPatternObj, true, matrix); } else { CPDF_Dictionary* pDict = pPatternObj->GetDict(); - if (!pDict) - return nullptr; - int type = pDict->GetIntegerFor("PatternType"); if (type == CPDF_Pattern::TILING) { pPattern = pdfium::MakeUnique<CPDF_TilingPattern>(m_pPDFDoc.Get(),
diff --git a/core/fpdfapi/page/cpdf_tilingpattern.cpp b/core/fpdfapi/page/cpdf_tilingpattern.cpp index faa7eb8..ce01d8a 100644 --- a/core/fpdfapi/page/cpdf_tilingpattern.cpp +++ b/core/fpdfapi/page/cpdf_tilingpattern.cpp
@@ -36,9 +36,6 @@ return true; const CPDF_Dictionary* pDict = pattern_obj()->GetDict(); - if (!pDict) - return false; - m_bColored = pDict->GetIntegerFor("PaintType") == 1; m_XStep = static_cast<float>(fabs(pDict->GetNumberFor("XStep"))); m_YStep = static_cast<float>(fabs(pDict->GetNumberFor("YStep")));