Kaydet (Commit) 01c463ef authored tarafından Stephan Bergmann's avatar Stephan Bergmann

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
üst 8da1d786
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment