summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdf_save.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/fpdf_save.cpp')
-rw-r--r--fpdfsdk/fpdf_save.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/fpdfsdk/fpdf_save.cpp b/fpdfsdk/fpdf_save.cpp
index 2844f5a965..e4a1a607bb 100644
--- a/fpdfsdk/fpdf_save.cpp
+++ b/fpdfsdk/fpdf_save.cpp
@@ -227,10 +227,11 @@ bool FPDF_Doc_Save(FPDF_DOCUMENT document,
return 0;
#ifdef PDF_ENABLE_XFA
- CPDFXFA_Context* pContext =
- static_cast<CPDFXFA_Context*>(pPDFDoc->GetExtension());
- std::vector<RetainPtr<IFX_SeekableStream>> fileList;
- SendPreSaveToXFADoc(pContext, &fileList);
+ auto* pContext = static_cast<CPDFXFA_Context*>(pPDFDoc->GetExtension());
+ if (pContext) {
+ std::vector<RetainPtr<IFX_SeekableStream>> fileList;
+ SendPreSaveToXFADoc(pContext, &fileList);
+ }
#endif // PDF_ENABLE_XFA
if (flags < FPDF_INCREMENTAL || flags > FPDF_REMOVE_SECURITY)
@@ -246,9 +247,11 @@ bool FPDF_Doc_Save(FPDF_DOCUMENT document,
}
bool bRet = fileMaker.Create(flags);
+
#ifdef PDF_ENABLE_XFA
SendPostSaveToXFADoc(pContext);
#endif // PDF_ENABLE_XFA
+
return bRet;
}