summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-08-22 18:20:00 +0200
committerStephan Bergmann <sbergman@redhat.com>2016-08-22 18:20:00 +0200
commit01c463efa2e2b96eaaa18dfb9d613abb2fbf95b1 (patch)
tree79cb9eec551b4364c1331f990477879f9d8cc72b
parent8da1d7869a2bdbe006265f584e0d9af5046ef723 (diff)
Avoid illegal cast of SwDropDownFieldType to SwSetExpFieldType
...once the loop reaches an SwDropDownFieldType (whose GetName() is empty), and m_pCategoryBox->GetText() is empty (which it appears is always the case here in the constructor?), as e.g. happens when opening Writer's "Tools - Options... - LibreOffice Writer - AutoCaption". Change-Id: I11128981f32691158e1d5de74117c1b1a9d5fea4
-rw-r--r--sw/source/ui/config/optload.cxx3
1 files changed, 2 insertions, 1 deletions
diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx
index 41c215ad4884..cde9a8b91b0c 100644
--- a/sw/source/ui/config/optload.cxx
+++ b/sw/source/ui/config/optload.cxx
@@ -487,7 +487,8 @@ SwCaptionOptPage::SwCaptionOptPage(vcl::Window* pParent, const SfxItemSet& rSet)
for ( auto i = pMgr->GetFieldTypeCount(); i; )
{
SwFieldType* pFieldType = pMgr->GetFieldType(USHRT_MAX, --i);
- if (pFieldType->GetName().equals(m_pCategoryBox->GetText()))
+ if (!pFieldType->GetName().isEmpty()
+ && pFieldType->GetName().equals(m_pCategoryBox->GetText()))
{
nSelFormat = (sal_uInt16)static_cast<SwSetExpFieldType*>(pFieldType)->GetSeqFormat();
break;