From c3f62db21878c8adc60beae5f534218b417daa40 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 3 May 2018 18:27:12 +0000 Subject: [xfa] Verify we can get a font manager before setting up XFA When setting up an XFA document we need to create a font manager. That font manager requires the CFGAS_FontMgr to be provided, and ASSERTs to that fact. It's possible for the CFGAS_FontMgr to be nullptr if we fail to enumerate the system fonts. This CL verifys we can get the needed manager and fails out of the XFA OpenDoc method if we have no font manager. Bug: chromium:835693 Change-Id: I806f265075dcc355e0a7aeb4b3ae8eb950aa5eee Reviewed-on: https://pdfium-review.googlesource.com/32052 Commit-Queue: dsinclair Commit-Queue: Ryan Harrison Reviewed-by: Ryan Harrison --- xfa/fxfa/cxfa_ffdoc.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'xfa') diff --git a/xfa/fxfa/cxfa_ffdoc.cpp b/xfa/fxfa/cxfa_ffdoc.cpp index 12e2a7b5f6..bc4a939078 100644 --- a/xfa/fxfa/cxfa_ffdoc.cpp +++ b/xfa/fxfa/cxfa_ffdoc.cpp @@ -116,11 +116,13 @@ bool CXFA_FFDoc::OpenDoc(CPDF_Document* pPDFDoc) { return false; } + CFGAS_FontMgr* mgr = GetApp()->GetFDEFontMgr(); + if (!mgr) + return false; + // At this point we've got an XFA document and we want to always return // true to signify the load succeeded. - - m_pPDFFontMgr = pdfium::MakeUnique( - GetPDFDoc(), GetApp()->GetFDEFontMgr()); + m_pPDFFontMgr = pdfium::MakeUnique(GetPDFDoc(), mgr); m_FormType = FormType::kXFAForeground; CXFA_Node* pConfig = ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Config)); -- cgit v1.2.3