Index: core/fpdfapi/parser/cpdf_parser.cpp |
diff --git a/core/fpdfapi/parser/cpdf_parser.cpp b/core/fpdfapi/parser/cpdf_parser.cpp |
index 5354417eda857de70bdb4de856e8fa75506e5192..2f432ed9f9c130ecf59354dc157eb548addaf127 100644 |
--- a/core/fpdfapi/parser/cpdf_parser.cpp |
+++ b/core/fpdfapi/parser/cpdf_parser.cpp |
@@ -1070,14 +1070,21 @@ bool CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, bool bMainXRef) { |
} |
CPDF_Array* CPDF_Parser::GetIDArray() { |
- CPDF_Object* pID = m_pTrailer ? m_pTrailer->GetObjectFor("ID") : nullptr; |
+ if (!m_pTrailer) |
+ return nullptr; |
+ |
+ CPDF_Object* pID = m_pTrailer->GetObjectFor("ID"); |
if (!pID) |
return nullptr; |
- if (CPDF_Reference* pRef = pID->AsReference()) { |
- pID = ParseIndirectObject(nullptr, pRef->GetRefObjNum()).release(); |
- m_pTrailer->SetFor("ID", pdfium::WrapUnique(pID)); |
- } |
+ CPDF_Reference* pRef = pID->AsReference(); |
+ if (!pRef) |
+ return ToArray(pID); |
+ |
+ std::unique_ptr<CPDF_Object> pNewObj = |
+ ParseIndirectObject(nullptr, pRef->GetRefObjNum()); |
+ pID = pNewObj.get(); |
+ m_pTrailer->SetFor("ID", std::move(pNewObj)); |
return ToArray(pID); |
} |