diff options
author | Caolán McNamara <caolanm@redhat.com> | 2023-05-11 16:03:57 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2023-05-11 21:39:21 +0200 |
commit | 4ae776b842a8b6f065206d3250113493fd688756 (patch) | |
tree | 67b32f2306cb4c8db91c36bd72b902d6c9faa0bc /vcl/source | |
parent | c8cb7a658b33e296024044f3377378644a9a97ef (diff) |
tdf#155241 keep current MetricSpinButton value if unparseable junk input
Change-Id: I0f13c9ae25c1788924fd81ed77307e96400f6220
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151677
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/control/fmtfield.cxx | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/vcl/source/control/fmtfield.cxx b/vcl/source/control/fmtfield.cxx index ed73accd3c7c..de5713261e83 100644 --- a/vcl/source/control/fmtfield.cxx +++ b/vcl/source/control/fmtfield.cxx @@ -266,6 +266,7 @@ Formatter::Formatter() ,m_bAutoColor(false) ,m_bEnableNaN(false) ,m_bDisableRemainderFactor(false) + ,m_bDefaultValueSet(false) ,m_ValueState(valueDirty) ,m_dCurrentValue(0) ,m_dDefaultValue(0) @@ -791,7 +792,11 @@ bool Formatter::ImplGetValue(double& dNewVal) if (m_ValueState == valueDouble) return true; - dNewVal = m_dDefaultValue; + // tdf#155241 default to m_dDefaultValue only if explicitly set + // otherwise default to m_dCurrentValue + if (m_bDefaultValueSet) + dNewVal = m_dDefaultValue; + OUString sText(GetEntryText()); if (sText.isEmpty()) return true; |