summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/fpdfapi/page/cpdf_image.cpp8
-rw-r--r--core/fpdfapi/page/cpdf_imageobject.cpp6
2 files changed, 7 insertions, 7 deletions
diff --git a/core/fpdfapi/page/cpdf_image.cpp b/core/fpdfapi/page/cpdf_image.cpp
index 89bcd3fa7b..ec4f414423 100644
--- a/core/fpdfapi/page/cpdf_image.cpp
+++ b/core/fpdfapi/page/cpdf_image.cpp
@@ -42,11 +42,14 @@ bool CPDF_Image::IsValidJpegBitsPerComponent(int32_t bpc) {
return bpc == 1 || bpc == 2 || bpc == 4 || bpc == 8 || bpc == 16;
}
-CPDF_Image::CPDF_Image(CPDF_Document* pDoc) : m_pDocument(pDoc) {}
+CPDF_Image::CPDF_Image(CPDF_Document* pDoc) : m_pDocument(pDoc) {
+ ASSERT(m_pDocument);
+}
CPDF_Image::CPDF_Image(CPDF_Document* pDoc,
std::unique_ptr<CPDF_Stream> pStream)
: m_bIsInline(true), m_pDocument(pDoc), m_pStream(std::move(pStream)) {
+ ASSERT(m_pDocument);
ASSERT(m_pStream.IsOwned());
FinishInitialization(m_pStream->GetDict());
}
@@ -54,11 +57,12 @@ CPDF_Image::CPDF_Image(CPDF_Document* pDoc,
CPDF_Image::CPDF_Image(CPDF_Document* pDoc, uint32_t dwStreamObjNum)
: m_pDocument(pDoc),
m_pStream(ToStream(pDoc->GetIndirectObject(dwStreamObjNum))) {
+ ASSERT(m_pDocument);
ASSERT(!m_pStream.IsOwned());
FinishInitialization(m_pStream->GetDict());
}
-CPDF_Image::~CPDF_Image() {}
+CPDF_Image::~CPDF_Image() = default;
void CPDF_Image::FinishInitialization(CPDF_Dictionary* pStreamDict) {
m_pOC = pStreamDict->GetDictFor("OC");
diff --git a/core/fpdfapi/page/cpdf_imageobject.cpp b/core/fpdfapi/page/cpdf_imageobject.cpp
index 2b3d7b0de3..4da0bf9b95 100644
--- a/core/fpdfapi/page/cpdf_imageobject.cpp
+++ b/core/fpdfapi/page/cpdf_imageobject.cpp
@@ -57,11 +57,7 @@ void CPDF_ImageObject::MaybePurgeCache() {
if (!m_pImage)
return;
- CPDF_Document* pDocument = m_pImage->GetDocument();
- if (!pDocument)
- return;
-
- CPDF_DocPageData* pPageData = pDocument->GetPageData();
+ CPDF_DocPageData* pPageData = m_pImage->GetDocument()->GetPageData();
if (!pPageData)
return;