diff options
author | Tamás Zolnai <tamas.zolnai@collabora.com> | 2019-03-10 09:45:56 +0100 |
---|---|---|
committer | Tamás Zolnai <tamas.zolnai@collabora.com> | 2019-03-10 11:15:12 +0100 |
commit | aa3b3ee8c2aad6af69f0710c7531ef2cf9fb1fc1 (patch) | |
tree | f6f3d657c58544748fe0a1cd3af2551e8931eacc /sw | |
parent | e9393e392e95ec8fcab77662790482aa0adf0f78 (diff) |
MSForms: Fix handling of drop-down form field after DOC import
In the properties dialog, code expected that the ODF_FORMDROPDOWN_RESULT
is not set in case of an empty list. This caused a crash.
The field popup window code expected that the list is not specified
when it is empty, but DOC import code sets ODF_FORMDROPDOWN_LISTENTRY
even if the list is empty.
Change-Id: If4c86fc5a08cdc578150afaa42ad7e86bdba9150
Reviewed-on: https://gerrit.libreoffice.org/68963
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Tested-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/crsr/DropDownFormFieldButton.cxx | 5 | ||||
-rw-r--r-- | sw/source/ui/fldui/DropDownFormFieldDialog.cxx | 3 |
2 files changed, 5 insertions, 3 deletions
diff --git a/sw/source/core/crsr/DropDownFormFieldButton.cxx b/sw/source/core/crsr/DropDownFormFieldButton.cxx index a4614da8932e..bef4c873dace 100644 --- a/sw/source/core/crsr/DropDownFormFieldButton.cxx +++ b/sw/source/core/crsr/DropDownFormFieldButton.cxx @@ -53,14 +53,15 @@ SwFieldDialog::SwFieldDialog(SwEditWin* parent, sw::mark::IFieldmark* fieldBM, l OUString sListKey = ODF_FORMDROPDOWN_LISTENTRY; sw::mark::IFieldmark::parameter_map_t::const_iterator pListEntries = pParameters->find(sListKey); + css::uno::Sequence<OUString> vListEntries; if (pListEntries != pParameters->end()) { - css::uno::Sequence<OUString> vListEntries; pListEntries->second >>= vListEntries; for (OUString const& i : vListEntries) aListBox->InsertEntry(i); } - else + + if (vListEntries.getLength() == 0) { aListBox->InsertEntry(SwResId(STR_DROP_DOWN_EMPTY_LIST)); } diff --git a/sw/source/ui/fldui/DropDownFormFieldDialog.cxx b/sw/source/ui/fldui/DropDownFormFieldDialog.cxx index e52907fd6c74..dd187704aa7a 100644 --- a/sw/source/ui/fldui/DropDownFormFieldDialog.cxx +++ b/sw/source/ui/fldui/DropDownFormFieldDialog.cxx @@ -119,7 +119,8 @@ void DropDownFormFieldDialog::InitControls() { sal_Int32 nSelection = -1; pResult->second >>= nSelection; - m_xListItemsTreeView->select_text(vListEntries[nSelection]); + if (vListEntries.getLength() > nSelection) + m_xListItemsTreeView->select_text(vListEntries[nSelection]); } } } |