summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_reference.cpp5
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_reference.h11
2 files changed, 8 insertions, 8 deletions
diff --git a/core/fpdfapi/fpdf_parser/cpdf_reference.cpp b/core/fpdfapi/fpdf_parser/cpdf_reference.cpp
index 06625a96ea..4f826dc86c 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_reference.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_reference.cpp
@@ -67,6 +67,11 @@ CPDF_Object* CPDF_Reference::CloneNonCyclic(
return new CPDF_Reference(m_pObjList, m_RefObjNum);
}
+CPDF_Object* CPDF_Reference::SafeGetDirect() const {
+ CPDF_Object* obj = GetDirect();
+ return (obj && !obj->IsReference()) ? obj : nullptr;
+}
+
void CPDF_Reference::SetRef(CPDF_IndirectObjectHolder* pDoc, uint32_t objnum) {
m_pObjList = pDoc;
m_RefObjNum = objnum;
diff --git a/core/fpdfapi/fpdf_parser/cpdf_reference.h b/core/fpdfapi/fpdf_parser/cpdf_reference.h
index af52f90c52..1322b97c6f 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_reference.h
+++ b/core/fpdfapi/fpdf_parser/cpdf_reference.h
@@ -25,8 +25,6 @@ class CPDF_Reference : public CPDF_Object {
FX_FLOAT GetNumber() const override;
int GetInteger() const override;
CPDF_Dictionary* GetDict() const override;
-
- // TODO(weili): check whether GetUnicodeText() and GetArray() are needed.
bool IsReference() const override;
CPDF_Reference* AsReference() override;
const CPDF_Reference* AsReference() const override;
@@ -38,15 +36,12 @@ class CPDF_Reference : public CPDF_Object {
protected:
~CPDF_Reference() override;
+
CPDF_Object* CloneNonCyclic(
bool bDirect,
std::set<const CPDF_Object*>* pVisited) const override;
- CPDF_Object* SafeGetDirect() const {
- CPDF_Object* obj = GetDirect();
- if (!obj || obj->IsReference())
- return nullptr;
- return obj;
- }
+
+ CPDF_Object* SafeGetDirect() const;
CPDF_IndirectObjectHolder* m_pObjList;
uint32_t m_RefObjNum;