summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-05-03 18:27:12 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-05-03 18:27:12 +0000
commitc3f62db21878c8adc60beae5f534218b417daa40 (patch)
tree5fbe4795a2bc08aa559051cdcadd362b48e23c9c
parentc5c0eebe863bb4fad86b43f62fa81d89f07c9011 (diff)
downloadpdfium-c3f62db21878c8adc60beae5f534218b417daa40.tar.xz
[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 <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
-rw-r--r--xfa/fxfa/cxfa_ffdoc.cpp8
1 files changed, 5 insertions, 3 deletions
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<CFGAS_PDFFontMgr>(
- GetPDFDoc(), GetApp()->GetFDEFontMgr());
+ m_pPDFFontMgr = pdfium::MakeUnique<CFGAS_PDFFontMgr>(GetPDFDoc(), mgr);
m_FormType = FormType::kXFAForeground;
CXFA_Node* pConfig = ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Config));