From bbe0e4d3b57f95e93535c95298203c62d62474fe Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 20 Oct 2015 15:41:40 -0700 Subject: 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 . --- fpdfsdk/src/fpdfview.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'fpdfsdk') 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(document); + if (page_index < 0 || page_index >= pDoc->GetPageCount()) return nullptr; return pDoc->GetPage(page_index); -- cgit v1.2.3