summaryrefslogtreecommitdiff
path: root/core/src/fpdfdoc
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/fpdfdoc')
-rw-r--r--core/src/fpdfdoc/doc_tagged.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/core/src/fpdfdoc/doc_tagged.cpp b/core/src/fpdfdoc/doc_tagged.cpp
index 551042037b..698157356c 100644
--- a/core/src/fpdfdoc/doc_tagged.cpp
+++ b/core/src/fpdfdoc/doc_tagged.cpp
@@ -192,8 +192,11 @@ FX_BOOL CPDF_StructTreeImpl::AddTopLevelNode(CPDF_Dictionary* pDict, CPDF_Struct
FX_DWORD i;
FX_BOOL bSave = FALSE;
for (i = 0; i < pTopKids->GetCount(); i ++) {
- CPDF_Reference* pKidRef = (CPDF_Reference*)pTopKids->GetElement(i);
- if (pKidRef->GetType() != PDFOBJ_REFERENCE || pKidRef->GetRefObjNum() != pDict->GetObjNum()) {
+ CPDF_Object* pKidRef = pTopKids->GetElement(i);
+ if (pKidRef == NULL || pKidRef->GetType() != PDFOBJ_REFERENCE) {
+ continue;
+ }
+ if (((CPDF_Reference*) pKidRef)->GetRefObjNum() != pDict->GetObjNum()) {
continue;
}
if (m_Kids[i]) {