Index: fpdfsdk/javascript/Field.cpp |
diff --git a/fpdfsdk/javascript/Field.cpp b/fpdfsdk/javascript/Field.cpp |
index 3f5e5e1b0f57ae9aabb2675b4a0705d8e1bee752..ab779f1c9487c3b01b0a5378551c8cec391121bd 100644 |
--- a/fpdfsdk/javascript/Field.cpp |
+++ b/fpdfsdk/javascript/Field.cpp |
@@ -273,8 +273,7 @@ void Field::UpdateFormField(CPDFSDK_Document* pDocument, |
CPDFSDK_Widget::Observer observer(&pAnnot); |
CFX_WideString sValue = pWidget->OnFormat(bFormatted); |
if (pAnnot) { |
- pWidget->ResetAppearance(bFormatted ? sValue.c_str() : nullptr, |
- FALSE); |
+ pWidget->ResetAppearance(bFormatted ? &sValue : nullptr, FALSE); |
} |
} |
} else { |
@@ -310,12 +309,9 @@ void Field::UpdateFormControl(CPDFSDK_Document* pDocument, |
int nFieldType = pWidget->GetFieldType(); |
if (nFieldType == FIELDTYPE_COMBOBOX || |
nFieldType == FIELDTYPE_TEXTFIELD) { |
- FX_BOOL bFormated = FALSE; |
- CFX_WideString sValue = pWidget->OnFormat(bFormated); |
- if (bFormated) |
- pWidget->ResetAppearance(sValue.c_str(), FALSE); |
- else |
- pWidget->ResetAppearance(nullptr, FALSE); |
+ FX_BOOL bFormatted = FALSE; |
+ CFX_WideString sValue = pWidget->OnFormat(bFormatted); |
+ pWidget->ResetAppearance(bFormatted ? &sValue : nullptr, FALSE); |
} else { |
pWidget->ResetAppearance(nullptr, FALSE); |
} |