diff options
Diffstat (limited to 'fpdfsdk/fpdf_formfill.cpp')
-rw-r--r-- | fpdfsdk/fpdf_formfill.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/fpdfsdk/fpdf_formfill.cpp b/fpdfsdk/fpdf_formfill.cpp index 5d762ee1f0..3170627cd5 100644 --- a/fpdfsdk/fpdf_formfill.cpp +++ b/fpdfsdk/fpdf_formfill.cpp @@ -287,7 +287,7 @@ FPDFDOC_InitFormFillEnvironment(FPDF_DOCUMENT document, if (!formInfo || formInfo->version != kRequiredVersion) return nullptr; - UnderlyingDocumentType* pDocument = UnderlyingFromFPDFDocument(document); + auto* pDocument = CPDFDocumentFromFPDFDocument(document); if (!pDocument) return nullptr; @@ -295,15 +295,16 @@ FPDFDOC_InitFormFillEnvironment(FPDF_DOCUMENT document, // If the CPDFXFA_Context has a FormFillEnvironment already then we've done // this and can just return the old Env. Otherwise, we'll end up setting a new // environment into the XFADocument and, that could get weird. - if (pDocument->GetFormFillEnv()) - return pDocument->GetFormFillEnv(); + auto* pContext = static_cast<CPDFXFA_Context*>(pDocument->GetExtension()); + if (pContext->GetFormFillEnv()) + return pContext->GetFormFillEnv(); #endif auto pFormFillEnv = pdfium::MakeUnique<CPDFSDK_FormFillEnvironment>( CPDFDocumentFromFPDFDocument(document), formInfo); #ifdef PDF_ENABLE_XFA - pDocument->SetFormFillEnv(pFormFillEnv.get()); + pContext->SetFormFillEnv(pFormFillEnv.get()); #endif // PDF_ENABLE_XFA return pFormFillEnv.release(); // Caller takes ownership. |