From 99acb1c816dc88dbda5d03ef28dbdaa928f7e22a Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 28 Nov 2017 17:15:48 +0000 Subject: [XFA] Use default values to optionals When accessing the margin data for a widget, the Inset values can come back as empty optionals. Those would only get values if there was a border data node present. If there is no border data node, we need to default the optional value. Bug: chromium:788246 Change-Id: Id3d5b76e8dc9d391aaa0d0440bf6ee2e2636fcdc Reviewed-on: https://pdfium-review.googlesource.com/19671 Reviewed-by: Ryan Harrison Commit-Queue: dsinclair --- xfa/fxfa/parser/cxfa_widgetdata.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'xfa') diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp index 4544e2eb51..4c8257a039 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.cpp +++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp @@ -392,7 +392,8 @@ CFX_RectF CXFA_WidgetData::GetUIMargin() { left = GetEdgeThickness(strokes, bVisible, 3); } } - return CFX_RectF(*left, *top, *right, *bottom); + return CFX_RectF(left.value_or(0.0), top.value_or(0.0), right.value_or(0.0), + bottom.value_or(0.0)); } XFA_ATTRIBUTEENUM CXFA_WidgetData::GetButtonHighlight() { -- cgit v1.2.3