summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/fpdfview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/src/fpdfview.cpp')
-rw-r--r--fpdfsdk/src/fpdfview.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/fpdfsdk/src/fpdfview.cpp b/fpdfsdk/src/fpdfview.cpp
index adb14cd3b9..2066631e3c 100644
--- a/fpdfsdk/src/fpdfview.cpp
+++ b/fpdfsdk/src/fpdfview.cpp
@@ -214,9 +214,10 @@ DLLEXPORT void STDCALL FPDF_InitLibraryWithConfig(
CFX_GEModule::Get()->SetCodecModule(g_pCodecModule);
CPDF_ModuleMgr::Create();
- CPDF_ModuleMgr::Get()->SetCodecModule(g_pCodecModule);
- CPDF_ModuleMgr::Get()->InitPageModule();
- CPDF_ModuleMgr::Get()->InitRenderModule();
+ CPDF_ModuleMgr* pModuleMgr = CPDF_ModuleMgr::Get();
+ pModuleMgr->SetCodecModule(g_pCodecModule);
+ pModuleMgr->InitPageModule();
+ pModuleMgr->InitRenderModule();
CPDFXFA_App::GetInstance()->Initialize();
if (cfg && cfg->version >= 2)
IJS_Runtime::Initialize(cfg->m_v8EmbedderSlot, cfg->m_pIsolate);
@@ -439,6 +440,7 @@ DLLEXPORT FPDF_PAGE STDCALL FPDF_LoadPage(FPDF_DOCUMENT document,
UnderlyingDocumentType* pDoc = UnderlyingFromFPDFDocument(document);
if (!pDoc)
return nullptr;
+
if (page_index < 0 || page_index >= pDoc->GetPageCount())
return nullptr;