From 8a1081fbf7f9fac94b32c59b5851387abdd24dea Mon Sep 17 00:00:00 2001 From: Jane Liu Date: Tue, 22 Aug 2017 16:28:05 -0400 Subject: Corrected the error setting after calling FPDF_LoadDocument() Currently, if FPDF_LoadDocument() is called on a nonexistent file, the returned FPDF_DOCUMENT will be null, but FPDF_GetLastError() will return an error of FPDF_ERR_SUCCESS, i.e. no error. This CL corrects this behavior by updating the error to be FPDF_ERR_FILE when the file doesn't exist. Bug=pdfium:452 Change-Id: I3c3ec3a64e049636ddfb2ba5cb5f2745a0e19b6b Reviewed-on: https://pdfium-review.googlesource.com/11650 Reviewed-by: dsinclair Commit-Queue: Jane Liu --- fpdfsdk/fpdfview.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'fpdfsdk/fpdfview.cpp') diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp index 964d769d2b..bf8daad958 100644 --- a/fpdfsdk/fpdfview.cpp +++ b/fpdfsdk/fpdfview.cpp @@ -275,8 +275,10 @@ bool CFPDF_FileStream::Flush() { FPDF_DOCUMENT LoadDocumentImpl( const CFX_RetainPtr& pFileAccess, FPDF_BYTESTRING password) { - if (!pFileAccess) + if (!pFileAccess) { + ProcessParseError(CPDF_Parser::FILE_ERROR); return nullptr; + } auto pParser = pdfium::MakeUnique(); pParser->SetPassword(password); -- cgit v1.2.3