Fix FPDFImageObj_LoadJpegFile(Inline) to allow NULL to be passed in for pages, as the documentation explicitly allows this.
Bug:pdfium:710
Change-Id: I0535b45c16ae7a53609da3b09ff7d427c52567b5
Reviewed-on: https://pdfium-review.googlesource.com/5270
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
diff --git a/fpdfsdk/fpdfeditimg.cpp b/fpdfsdk/fpdfeditimg.cpp
index 1207ecf..6a300c9 100644
--- a/fpdfsdk/fpdfeditimg.cpp
+++ b/fpdfsdk/fpdfeditimg.cpp
@@ -20,16 +20,19 @@
FPDF_PAGEOBJECT image_object,
FPDF_FILEACCESS* fileAccess,
bool inlineJpeg) {
- if (!image_object || !fileAccess || !pages)
+ if (!image_object || !fileAccess)
return false;
CFX_RetainPtr<IFX_SeekableReadStream> pFile =
MakeSeekableReadStream(fileAccess);
CPDF_ImageObject* pImgObj = reinterpret_cast<CPDF_ImageObject*>(image_object);
- for (int index = 0; index < nCount; index++) {
- CPDF_Page* pPage = CPDFPageFromFPDFPage(pages[index]);
- if (pPage)
- pImgObj->GetImage()->ResetCache(pPage, nullptr);
+
+ if (pages) {
+ for (int index = 0; index < nCount; index++) {
+ CPDF_Page* pPage = CPDFPageFromFPDFPage(pages[index]);
+ if (pPage)
+ pImgObj->GetImage()->ResetCache(pPage, nullptr);
+ }
}
if (inlineJpeg)