sw/source/core/text/itrform2.cxx | 2 +- sw/source/filter/ww8/ww8par3.cxx | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-)
New commits: commit 0ded9060376a2bec9ad9e252882bf5b3e0efc466 Author: Justin Luth <justin.l...@collabora.com> AuthorDate: Mon Nov 7 15:35:14 2022 -0500 Commit: Justin Luth <jl...@mail.com> CommitDate: Mon Nov 14 18:37:58 2022 +0100 ww8import: 0 is a valid ODF_FORMDROPDOWN_RESULT The correct response when there are no choices is to erase ODF_FORMDROPDOWN_RESULT. 0 points to the first entry in the list, so it is invalid to suggest that such an entry exists when it doesn't. Change-Id: I4cb20428c7448a24ae8801e15407d478286a96e0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142409 Reviewed-by: Justin Luth <jl...@mail.com> Tested-by: Jenkins diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx index aada2e757e1d..db66d59913d5 100644 --- a/sw/source/core/text/itrform2.cxx +++ b/sw/source/core/text/itrform2.cxx @@ -1111,7 +1111,7 @@ namespace sw::mark { assert(pBM->GetFieldname() == ODF_FORMDROPDOWN); const IFieldmark::parameter_map_t* const pParameters = pBM->GetParameters(); sal_Int32 nCurrentIdx = 0; - const IFieldmark::parameter_map_t::const_iterator pResult = pParameters->find(OUString(ODF_FORMDROPDOWN_RESULT)); + const IFieldmark::parameter_map_t::const_iterator pResult = pParameters->find(ODF_FORMDROPDOWN_RESULT); if(pResult != pParameters->end()) pResult->second >>= nCurrentIdx; diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx index d4081a4d055f..f02a2972e058 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -305,8 +305,9 @@ eF_ResT SwWW8ImplReader::Read_F_FormListBox( WW8FieldDesc* pF, OUString& rStr) uno::Sequence< OUString > vListEntries(aFormula.maListEntries.size()); std::copy(aFormula.maListEntries.begin(), aFormula.maListEntries.end(), vListEntries.getArray()); (*pFieldmark->GetParameters())[ODF_FORMDROPDOWN_LISTENTRY] <<= vListEntries; - sal_Int32 nIndex = aFormula.mfDropdownIndex < aFormula.maListEntries.size() ? aFormula.mfDropdownIndex : 0; - (*pFieldmark->GetParameters())[ODF_FORMDROPDOWN_RESULT] <<= nIndex; + sal_Int32 nIndex = aFormula.mfDropdownIndex < aFormula.maListEntries.size() ? aFormula.mfDropdownIndex : -1; + if (nIndex >= 0) + (*pFieldmark->GetParameters())[ODF_FORMDROPDOWN_RESULT] <<= nIndex; // set field data here... } }