summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdf_formfill.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-05-07 20:26:46 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-05-07 20:26:46 +0000
commite7207f33f8024b59fc85abb1b4594b0fbab5361b (patch)
tree7a8427a440e7e9c808af3a96fa700282ca3b420c /fpdfsdk/fpdf_formfill.cpp
parent8dcab3c246751763e044a5ba5378e55e2274cde6 (diff)
downloadpdfium-e7207f33f8024b59fc85abb1b4594b0fbab5361b.tar.xz
Ensure that XFA Pages always have a corresponding PDF page
The PDF page may be blank, un-numbered, or untracked by CPDF, but this provides a place for all XFA pages to "extend" from down the road. Change-Id: If1003be0f261154e61e9793ccba7e1f43cd73104 Reviewed-on: https://pdfium-review.googlesource.com/31771 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdf_formfill.cpp')
-rw-r--r--fpdfsdk/fpdf_formfill.cpp26
1 files changed, 16 insertions, 10 deletions
diff --git a/fpdfsdk/fpdf_formfill.cpp b/fpdfsdk/fpdf_formfill.cpp
index 280ef62edb..c92fc7b718 100644
--- a/fpdfsdk/fpdf_formfill.cpp
+++ b/fpdfsdk/fpdf_formfill.cpp
@@ -621,7 +621,11 @@ FPDF_EXPORT void FPDF_CALLCONV FORM_DoDocumentAAction(FPDF_FORMHANDLE hHandle,
if (!pDict)
return;
- CPDF_AAction aa(pDict->GetDictFor("AA"));
+ CPDF_Dictionary* pActionDict = pDict->GetDictFor("AA");
+ if (!pActionDict)
+ return;
+
+ CPDF_AAction aa(pActionDict);
auto type = static_cast<CPDF_AAction::AActionType>(aaType);
if (aa.ActionExist(type)) {
CPDF_Action action = aa.GetAction(type);
@@ -641,20 +645,22 @@ FPDF_EXPORT void FPDF_CALLCONV FORM_DoPageAAction(FPDF_PAGE page,
UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page);
CPDF_Page* pPDFPage = CPDFPageFromFPDFPage(page);
- if (!pPDFPage)
- return;
-
- if (!pFormFillEnv->GetPageView(pPage, false))
+ if (!pPDFPage || !pFormFillEnv->GetPageView(pPage, false))
return;
CPDFSDK_ActionHandler* pActionHandler = pFormFillEnv->GetActionHandler();
CPDF_Dictionary* pPageDict = pPDFPage->m_pFormDict.Get();
- CPDF_AAction aa(pPageDict->GetDictFor("AA"));
+ if (!pPageDict)
+ return;
+
+ CPDF_Dictionary* pActionDict = pPageDict->GetDictFor("AA");
+ if (!pActionDict)
+ return;
+
+ CPDF_AAction aa(pActionDict);
CPDF_AAction::AActionType type = aaType == FPDFPAGE_AACTION_OPEN
? CPDF_AAction::OpenPage
: CPDF_AAction::ClosePage;
- if (aa.ActionExist(type)) {
- CPDF_Action action = aa.GetAction(type);
- pActionHandler->DoAction_Page(action, type, pFormFillEnv);
- }
+ if (aa.ActionExist(type))
+ pActionHandler->DoAction_Page(aa.GetAction(type), type, pFormFillEnv);
}