summaryrefslogtreecommitdiff
path: root/core/src/fpdfdoc/doc_action.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/fpdfdoc/doc_action.cpp')
-rw-r--r--core/src/fpdfdoc/doc_action.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/core/src/fpdfdoc/doc_action.cpp b/core/src/fpdfdoc/doc_action.cpp
index 409d050484..759a06c656 100644
--- a/core/src/fpdfdoc/doc_action.cpp
+++ b/core/src/fpdfdoc/doc_action.cpp
@@ -251,10 +251,13 @@ CPDF_Action CPDF_Action::GetSubAction(FX_DWORD iIndex) const {
return CPDF_Action();
}
CPDF_Object* pNext = m_pDict->GetElementValue("Next");
- if (CPDF_Dictionary* pDict = ToDictionary(pNext)) {
- if (iIndex == 0)
+ int iObjType = pNext->GetType();
+ if (iObjType == PDFOBJ_DICTIONARY) {
+ CPDF_Dictionary* pDict = static_cast<CPDF_Dictionary*>(pNext);
+ if (iIndex == 0) {
return CPDF_Action(pDict);
- } else if (pNext->GetType() == PDFOBJ_ARRAY) {
+ }
+ } else if (iObjType == PDFOBJ_ARRAY) {
CPDF_Array* pArray = static_cast<CPDF_Array*>(pNext);
return CPDF_Action(pArray->GetDict(iIndex));
}
@@ -292,10 +295,9 @@ CPDF_Action CPDF_AAction::GetNextAction(FX_POSITION& pos,
return CPDF_Action();
}
CPDF_Object* pDirect = pObj->GetDirect();
- CPDF_Dictionary* pDict = ToDictionary(pDirect);
- if (!pDict)
+ if (!pDirect || pDirect->GetType() != PDFOBJ_DICTIONARY) {
return CPDF_Action();
-
+ }
int i = 0;
while (g_sAATypes[i][0] != '\0') {
if (csKey == g_sAATypes[i]) {
@@ -304,7 +306,7 @@ CPDF_Action CPDF_AAction::GetNextAction(FX_POSITION& pos,
i++;
}
eType = (AActionType)i;
- return CPDF_Action(pDict);
+ return CPDF_Action(static_cast<CPDF_Dictionary*>(pDirect));
}
CPDF_DocJSActions::CPDF_DocJSActions(CPDF_Document* pDoc) {
m_pDocument = pDoc;
@@ -319,7 +321,7 @@ CPDF_Action CPDF_DocJSActions::GetJSAction(int index,
ASSERT(m_pDocument != NULL);
CPDF_NameTree name_tree(m_pDocument, FX_BSTRC("JavaScript"));
CPDF_Object* pAction = name_tree.LookupValue(index, csName);
- if (!ToDictionary(pAction)) {
+ if (pAction == NULL || pAction->GetType() != PDFOBJ_DICTIONARY) {
return CPDF_Action();
}
return CPDF_Action(pAction->GetDict());
@@ -328,7 +330,7 @@ CPDF_Action CPDF_DocJSActions::GetJSAction(const CFX_ByteString& csName) const {
ASSERT(m_pDocument != NULL);
CPDF_NameTree name_tree(m_pDocument, FX_BSTRC("JavaScript"));
CPDF_Object* pAction = name_tree.LookupValue(csName);
- if (!ToDictionary(pAction)) {
+ if (pAction == NULL || pAction->GetType() != PDFOBJ_DICTIONARY) {
return CPDF_Action();
}
return CPDF_Action(pAction->GetDict());