summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/fpdfview.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-10-20 15:41:40 -0700
committerTom Sepez <tsepez@chromium.org>2015-10-20 15:41:40 -0700
commitbbe0e4d3b57f95e93535c95298203c62d62474fe (patch)
tree4ea0c555d93c6f454e526c3bf66ea008454c5f91 /fpdfsdk/src/fpdfview.cpp
parent0522497f8926993166d5d2ffea256083a9a8dc11 (diff)
downloadpdfium-bbe0e4d3b57f95e93535c95298203c62d62474fe.tar.xz
XFA: Fix unittests and embeddertests crashers
The unittests had a case where we added an abort() call to the code, but left the case. And one of the expected results was not updated with the code. The fpdfview.cpp got broken by a recent change, and was not caught due to all the void* returns. Also, the tests now clean up the page automatically. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1403373006 .
Diffstat (limited to 'fpdfsdk/src/fpdfview.cpp')
-rw-r--r--fpdfsdk/src/fpdfview.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/fpdfsdk/src/fpdfview.cpp b/fpdfsdk/src/fpdfview.cpp
index c2157e96bd..e58c53646b 100644
--- a/fpdfsdk/src/fpdfview.cpp
+++ b/fpdfsdk/src/fpdfview.cpp
@@ -427,11 +427,10 @@ DLLEXPORT int STDCALL FPDF_GetPageCount(FPDF_DOCUMENT document) {
DLLEXPORT FPDF_PAGE STDCALL FPDF_LoadPage(FPDF_DOCUMENT document,
int page_index) {
- CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
- if (!pDoc)
+ if (!document)
return nullptr;
-
- if (page_index < 0 || page_index >= FPDF_GetPageCount(document))
+ CPDFXFA_Document* pDoc = static_cast<CPDFXFA_Document*>(document);
+ if (page_index < 0 || page_index >= pDoc->GetPageCount())
return nullptr;
return pDoc->GetPage(page_index);