writerfilter: fix crash in DomainMapper_Impl::handleIndex()

Crashreport signature:

program/libwriterfilterlo.so
      writerfilter::dmapper::DomainMapper_Impl::handleIndex(tools::SvRef<writerfilter::dmapper::FieldContext> const&, rtl::OUString const&)
              writerfilter/source/dmapper/DomainMapper_Impl.cxx:6116
program/libwriterfilterlo.so
      writerfilter::dmapper::DomainMapper_Impl::CloseFieldCommand()
              include/rtl/ustring.hxx:527
program/libwriterfilterlo.so
      writerfilter::dmapper::DomainMapper::lcl_text(unsigned char const*, unsigned long)
              writerfilter/source/dmapper/DomainMapper.cxx:3735
program/libwriterfilterlo.so
      writerfilter::rtftok::RTFDocumentImpl::singleChar(unsigned char, bool)
              writerfilter/source/rtftok/rtfdocumentimpl.hxx:718

Change-Id: I4e0f93ce50c8c9a1f9a1a0f9204bd4fee70cdde4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151502
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
This commit is contained in:
Miklos Vajna 2023-05-08 12:08:01 +02:00
parent 4d3d1527c4
commit 1e75a434e3

View File

@ -6800,7 +6800,10 @@ void DomainMapper_Impl::handleIndex
{
sValue = sValue.replaceAll("\"", "");
uno::Reference<text::XTextColumns> xTextColumns;
xTOC->getPropertyValue(getPropertyName( PROP_TEXT_COLUMNS )) >>= xTextColumns;
if (xTOC.is())
{
xTOC->getPropertyValue(getPropertyName( PROP_TEXT_COLUMNS )) >>= xTextColumns;
}
if (xTextColumns.is())
{
xTextColumns->setColumnCount( sValue.toInt32() );