summaryrefslogtreecommitdiff
path: root/fxjs/cfxjse_formcalc_context.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-11-16 14:17:17 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-11-16 14:17:17 +0000
commit9d608ff14177cd665f6b2ead639415bda935fbe2 (patch)
treed538fbf435ed55cf07ff37c24bc835507c12466d /fxjs/cfxjse_formcalc_context.cpp
parent9d47de6b27b167db46b6aba38352fc42a8b6adae (diff)
downloadpdfium-9d608ff14177cd665f6b2ead639415bda935fbe2.tar.xz
Cleanup CJX_Node::GetAttribute
This CL renames GetAttribute to TryAttribute and changes to return a pdfium::Optional instead of a boolean with an out parameter. GetAttribute is then added to call TryAttribute to mirror the other methods in the file. Change-Id: I875dac120776af7c53fe069e4dd36e5486838447 Reviewed-on: https://pdfium-review.googlesource.com/18514 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fxjs/cfxjse_formcalc_context.cpp')
-rw-r--r--fxjs/cfxjse_formcalc_context.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/fxjs/cfxjse_formcalc_context.cpp b/fxjs/cfxjse_formcalc_context.cpp
index 30fa18737b..e7e0e48871 100644
--- a/fxjs/cfxjse_formcalc_context.cpp
+++ b/fxjs/cfxjse_formcalc_context.cpp
@@ -5966,8 +5966,12 @@ int32_t CFXJSE_FormCalcContext::ResolveObjects(
ASSERT(pNode);
if (bHasNoResolveName) {
WideString wsName;
- if (CXFA_Node* pXFANode = pNode->AsNode())
- pXFANode->JSNode()->GetAttribute(XFA_Attribute::Name, wsName, false);
+ if (CXFA_Node* pXFANode = pNode->AsNode()) {
+ pdfium::Optional<WideString> ret =
+ pXFANode->JSNode()->TryAttribute(XFA_Attribute::Name, false);
+ if (ret)
+ wsName = *ret;
+ }
if (wsName.IsEmpty())
wsName = L"#" + pNode->GetClassName();