From 1e75a434e349110990bcccd80b5c63c11080853e Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Mon, 8 May 2023 12:08:01 +0200 Subject: [PATCH] writerfilter: fix crash in DomainMapper_Impl::handleIndex() Crashreport signature: program/libwriterfilterlo.so writerfilter::dmapper::DomainMapper_Impl::handleIndex(tools::SvRef 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 Tested-by: Jenkins --- writerfilter/source/dmapper/DomainMapper_Impl.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index b3942b4654e9..83ce570dcbab 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -6800,7 +6800,10 @@ void DomainMapper_Impl::handleIndex { sValue = sValue.replaceAll("\"", ""); uno::Reference 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() );