diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2018-01-10 20:47:55 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-01-10 20:47:55 +0000 |
commit | 3ffde1bc73156098e78e5e303b3f5198a1d073b8 (patch) | |
tree | c3a13bfda69bfb9bc4a85855d588d64d27faaa57 /xfa/fxfa/parser/cxfa_node.cpp | |
parent | 326c38c4f2749e61fa2dec1d0f326e4099d6a24c (diff) | |
download | pdfium-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_node.cpp')
-rw-r--r-- | xfa/fxfa/parser/cxfa_node.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp index 12a6ee4a0a..54b4661ce3 100644 --- a/xfa/fxfa/parser/cxfa_node.cpp +++ b/xfa/fxfa/parser/cxfa_node.cpp @@ -478,7 +478,7 @@ CXFA_Node* CXFA_Node::CloneTemplateToForm(bool bRecursive) { return pClone; } -CXFA_Node* CXFA_Node::GetTemplateNode() const { +CXFA_Node* CXFA_Node::GetTemplateNodeIfExists() const { return m_pAuxNode; } @@ -1286,7 +1286,10 @@ void CXFA_Node::RemoveItem(CXFA_Node* pRemoveInstance, CXFA_Node* CXFA_Node::CreateInstance(bool bDataMerge) { CXFA_Document* pDocument = GetDocument(); - CXFA_Node* pTemplateNode = GetTemplateNode(); + CXFA_Node* pTemplateNode = GetTemplateNodeIfExists(); + if (!pTemplateNode) + return nullptr; + CXFA_Node* pFormParent = GetParent(); CXFA_Node* pDataScope = nullptr; for (CXFA_Node* pRootBoundNode = pFormParent; @@ -1300,6 +1303,7 @@ CXFA_Node* CXFA_Node::CreateInstance(bool bDataMerge) { pDataScope = ToNode(pDocument->GetXFAObject(XFA_HASHCODE_Record)); ASSERT(pDataScope); } + CXFA_Node* pInstance = pDocument->DataMerge_CopyContainer( pTemplateNode, pFormParent, pDataScope, true, bDataMerge, true); if (pInstance) { @@ -1590,8 +1594,10 @@ bool CXFA_Node::IsOpenAccess() { } CXFA_Value* CXFA_Node::GetDefaultValue() { - CXFA_Node* pTemNode = GetTemplateNode(); - return pTemNode->JSObject()->GetProperty<CXFA_Value>(0, XFA_Element::Value); + CXFA_Node* pTemNode = GetTemplateNodeIfExists(); + return pTemNode ? pTemNode->JSObject()->GetProperty<CXFA_Value>( + 0, XFA_Element::Value) + : nullptr; } CXFA_Value* CXFA_Node::GetFormValue() const { |