summaryrefslogtreecommitdiff
path: root/fpdfsdk/javascript/Field.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/javascript/Field.cpp')
-rw-r--r--fpdfsdk/javascript/Field.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/fpdfsdk/javascript/Field.cpp b/fpdfsdk/javascript/Field.cpp
index a788fb203b..9ecdec6936 100644
--- a/fpdfsdk/javascript/Field.cpp
+++ b/fpdfsdk/javascript/Field.cpp
@@ -275,7 +275,7 @@ void Field::UpdateFormField(CPDFSDK_Document* pDocument,
static_cast<CPDFSDK_Widget*>(pAnnot)->OnFormat(bFormatted);
if (pAnnot) {
static_cast<CPDFSDK_Widget*>(pAnnot)->ResetAppearance(
- bFormatted ? sValue.c_str() : nullptr, FALSE);
+ bFormatted ? &sValue : nullptr, FALSE);
}
}
} else {
@@ -319,10 +319,7 @@ void Field::UpdateFormControl(CPDFSDK_Document* pDocument,
nFieldType == FIELDTYPE_TEXTFIELD) {
FX_BOOL bFormatted = FALSE;
CFX_WideString sValue = pWidget->OnFormat(bFormatted);
- if (bFormatted)
- pWidget->ResetAppearance(sValue.c_str(), FALSE);
- else
- pWidget->ResetAppearance(nullptr, FALSE);
+ pWidget->ResetAppearance(bFormatted ? &sValue : nullptr, FALSE);
} else {
pWidget->ResetAppearance(nullptr, FALSE);
}