| Index: core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp
|
| diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp
|
| index 5333fe808786f231ee62be815ee7773cda799baa..67c18f8ae0f182a00aac49f3d6948bc9c9ebe3d9 100644
|
| --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp
|
| +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp
|
| @@ -190,9 +190,8 @@ int CPDF_Document::_FindPageIndex(CPDF_Dictionary* pNode,
|
| }
|
| if (count && count == pKidList->GetCount()) {
|
| for (FX_DWORD i = 0; i < count; i++) {
|
| - CPDF_Object* pKid = pKidList->GetElement(i);
|
| - if (pKid && pKid->GetType() == PDFOBJ_REFERENCE) {
|
| - if (((CPDF_Reference*)pKid)->GetRefObjNum() == objnum) {
|
| + if (CPDF_Reference* pKid = ToReference(pKidList->GetElement(i))) {
|
| + if (pKid->GetRefObjNum() == objnum) {
|
| m_PageList.SetAt(index + i, objnum);
|
| return index + i;
|
| }
|
| @@ -308,13 +307,9 @@ FX_BOOL CPDF_Document::IsContentUsedElsewhere(FX_DWORD objnum,
|
| if (pContents->GetDirectType() == PDFOBJ_ARRAY) {
|
| CPDF_Array* pArray = pContents->GetDirect()->AsArray();
|
| for (FX_DWORD j = 0; j < pArray->GetCount(); j++) {
|
| - CPDF_Object* pRef = pArray->GetElement(j);
|
| - if (pRef == NULL || pRef->GetType() != PDFOBJ_REFERENCE) {
|
| - continue;
|
| - }
|
| - if (((CPDF_Reference*)pRef)->GetRefObjNum() == objnum) {
|
| + CPDF_Reference* pRef = ToReference(pArray->GetElement(j));
|
| + if (pRef && pRef->GetRefObjNum() == objnum)
|
| return TRUE;
|
| - }
|
| }
|
| } else if (pContents->GetObjNum() == objnum) {
|
| return TRUE;
|
|
|