summaryrefslogtreecommitdiff
path: root/fxjs/cjx_node.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fxjs/cjx_node.cpp')
-rw-r--r--fxjs/cjx_node.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/fxjs/cjx_node.cpp b/fxjs/cjx_node.cpp
index 6b717f2d9d..3442b35b9d 100644
--- a/fxjs/cjx_node.cpp
+++ b/fxjs/cjx_node.cpp
@@ -193,10 +193,11 @@ bool CJX_Node::SetAttribute(XFA_Attribute eAttr,
XFA_AttributeType eType = GetXFANode()->GetAttributeType(eAttr);
switch (eType) {
case XFA_AttributeType::Enum: {
- const XFA_ATTRIBUTEENUMINFO* pEnum = XFA_GetAttributeEnumByName(wsValue);
- return SetEnum(
- eAttr, pEnum ? pEnum->eName : *(GetXFANode()->GetDefaultEnum(eAttr)),
- bNotify);
+ pdfium::Optional<XFA_ATTRIBUTEENUM> item =
+ CXFA_Node::NameToAttributeEnum(wsValue);
+ return SetEnum(eAttr,
+ item ? *item : *(GetXFANode()->GetDefaultEnum(eAttr)),
+ bNotify);
}
case XFA_AttributeType::CData:
return SetCData(eAttr, WideString(wsValue), bNotify, false);