summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/cxfa_imagedata.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fxfa/parser/cxfa_imagedata.cpp')
-rw-r--r--xfa/fxfa/parser/cxfa_imagedata.cpp29
1 files changed, 23 insertions, 6 deletions
diff --git a/xfa/fxfa/parser/cxfa_imagedata.cpp b/xfa/fxfa/parser/cxfa_imagedata.cpp
index 7c5a06541a..2ad891d7ec 100644
--- a/xfa/fxfa/parser/cxfa_imagedata.cpp
+++ b/xfa/fxfa/parser/cxfa_imagedata.cpp
@@ -16,14 +16,26 @@ int32_t CXFA_ImageData::GetAspect() {
}
bool CXFA_ImageData::GetContentType(WideString& wsContentType) {
- return m_pNode->JSNode()->TryCData(XFA_Attribute::ContentType, wsContentType,
- true);
+ pdfium::Optional<WideString> content =
+ m_pNode->JSNode()->TryCData(XFA_Attribute::ContentType, true);
+ if (!content)
+ return false;
+
+ wsContentType = *content;
+ return true;
}
bool CXFA_ImageData::GetHref(WideString& wsHref) {
- if (m_bDefValue)
- return m_pNode->JSNode()->TryCData(XFA_Attribute::Href, wsHref, true);
- return m_pNode->JSNode()->GetAttribute(L"href", wsHref, true);
+ if (m_bDefValue) {
+ pdfium::Optional<WideString> ret =
+ m_pNode->JSNode()->TryCData(XFA_Attribute::Href, true);
+ if (!ret)
+ return false;
+
+ wsHref = *ret;
+ return true;
+ }
+ return m_pNode->JSNode()->GetAttribute(XFA_Attribute::Href, wsHref, true);
}
XFA_ATTRIBUTEENUM CXFA_ImageData::GetTransferEncoding() {
@@ -35,7 +47,12 @@ XFA_ATTRIBUTEENUM CXFA_ImageData::GetTransferEncoding() {
}
bool CXFA_ImageData::GetContent(WideString& wsText) {
- return m_pNode->JSNode()->TryContent(wsText, false, true);
+ pdfium::Optional<WideString> ret = m_pNode->JSNode()->TryContent(false, true);
+ if (!ret)
+ return false;
+
+ wsText = *ret;
+ return true;
}
bool CXFA_ImageData::SetContentType(const WideString& wsContentType) {