summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-01-10 20:47:55 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-01-10 20:47:55 +0000
commit3ffde1bc73156098e78e5e303b3f5198a1d073b8 (patch)
treec3a13bfda69bfb9bc4a85855d588d64d27faaa57 /xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
parent326c38c4f2749e61fa2dec1d0f326e4099d6a24c (diff)
downloadpdfium-3ffde1bc73156098e78e5e303b3f5198a1d073b8.tar.xz
Rename GetTemplateNode to GetTemplateNodeIfExists
This CL makes it explicit that GetTemplateNodeIfExists can return nullptr. Various call sites are updated as needed. Change-Id: If6edd5962b59e7e4ce3dbe9bbdc957783cf76abe Reviewed-on: https://pdfium-review.googlesource.com/22678 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser/cxfa_layoutpagemgr.cpp')
-rw-r--r--xfa/fxfa/parser/cxfa_layoutpagemgr.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
index c5b7d52caa..d30143c035 100644
--- a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
+++ b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
@@ -144,6 +144,9 @@ void RemoveLayoutItem(CXFA_ContainerLayoutItem* pLayoutItem) {
CXFA_Node* ResolveBreakTarget(CXFA_Node* pPageSetRoot,
bool bNewExprStyle,
WideString& wsTargetAll) {
+ if (!pPageSetRoot)
+ return nullptr;
+
CXFA_Document* pDocument = pPageSetRoot->GetDocument();
if (wsTargetAll.IsEmpty())
return nullptr;
@@ -282,7 +285,7 @@ CXFA_LayoutPageMgr::~CXFA_LayoutPageMgr() {
bool CXFA_LayoutPageMgr::InitLayoutPage(CXFA_Node* pFormNode) {
PrepareLayout();
- CXFA_Node* pTemplateNode = pFormNode->GetTemplateNode();
+ CXFA_Node* pTemplateNode = pFormNode->GetTemplateNodeIfExists();
if (!pTemplateNode)
return false;
@@ -811,7 +814,7 @@ bool CXFA_LayoutPageMgr::ExecuteBreakBeforeOrAfter(
WideString wsBreakLeader;
WideString wsBreakTrailer;
CXFA_Node* pFormNode = pCurNode->GetContainerParent();
- CXFA_Node* pContainer = pFormNode->GetTemplateNode();
+ CXFA_Node* pContainer = pFormNode->GetTemplateNodeIfExists();
bool bStartNew =
pCurNode->JSObject()->GetInteger(XFA_Attribute::StartNew) != 0;
CXFA_Script* pScript =
@@ -938,7 +941,7 @@ CXFA_Node* CXFA_LayoutPageMgr::BreakOverflow(CXFA_Node* pOverflowNode,
CXFA_Node*& pTrailerTemplate,
bool bCreatePage) {
CXFA_Node* pContainer =
- pOverflowNode->GetContainerParent()->GetTemplateNode();
+ pOverflowNode->GetContainerParent()->GetTemplateNodeIfExists();
if (pOverflowNode->GetElementType() == XFA_Element::Break) {
WideString wsOverflowLeader =
pOverflowNode->JSObject()->GetCData(XFA_Attribute::OverflowLeader);
@@ -1069,7 +1072,8 @@ bool CXFA_LayoutPageMgr::ResolveBookendLeaderOrTrailer(
CXFA_Node* pBookendNode,
bool bLeader,
CXFA_Node*& pBookendAppendTemplate) {
- CXFA_Node* pContainer = pBookendNode->GetContainerParent()->GetTemplateNode();
+ CXFA_Node* pContainer =
+ pBookendNode->GetContainerParent()->GetTemplateNodeIfExists();
if (pBookendNode->GetElementType() == XFA_Element::Break) {
WideString leader = pBookendNode->JSObject()->GetCData(
bLeader ? XFA_Attribute::BookendLeader : XFA_Attribute::BookendTrailer);
@@ -1800,7 +1804,8 @@ void CXFA_LayoutPageMgr::MergePageSetContents() {
CXFA_Node* pParentNode = pContainerItem->m_pParent->m_pFormNode;
for (CXFA_Node* pChildNode = pParentNode->GetFirstChild(); pChildNode;
pChildNode = pChildNode->GetNextSibling()) {
- if (pChildNode->GetTemplateNode() != pContainerItem->m_pFormNode) {
+ if (pChildNode->GetTemplateNodeIfExists() !=
+ pContainerItem->m_pFormNode) {
continue;
}
pContainerItem->m_pFormNode = pChildNode;