writerfilter/source/dmapper/DomainMapper_Impl.cxx |    5 +++++
 1 file changed, 5 insertions(+)

New commits:
commit f074a678d5d04f259fb53de651f56c9cc14dd274
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Fri Oct 15 08:40:22 2021 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Wed Oct 20 10:30:16 2021 +0200

    writerfilter: give up if body text is missing
    
    Crashreport trace:
    
    
writerfilter::dmapper::DomainMapper_Impl::DomainMapper_Impl(writerfilter::dmapper::DomainMapper&,
 com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&, 
com::sun::star::uno::Reference<com::sun::star::lang::XComponent> const&, 
writerfilter::dmapper::SourceDocumentType, utl::MediaDescriptor const&)
            writerfilter/source/dmapper/DomainMapper_Impl.cxx:359 
(discriminator 2)
    
writerfilter::dmapper::DomainMapper::DomainMapper(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext>
 const&, com::sun::star::uno::Reference<com::sun::star::io::XInputStream> 
const&, com::sun::star::uno::Reference<com::sun::star::lang::XComponent> 
const&, bool, writerfilter::dmapper::SourceDocumentType, utl::MediaDescriptor 
const&)
            writerfilter/source/dmapper/DomainMapper.cxx:113
    
writerfilter::dmapper::DomainMapperFactory::createMapper(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext>
 const&, com::sun::star::uno::Reference<com::sun::star::io::XInputStream> 
const&, com::sun::star::uno::Reference<com::sun::star::lang::XComponent> 
const&, bool, writerfilter::dmapper::SourceDocumentType, utl::MediaDescriptor 
const&)
            writerfilter/source/dmapper/domainmapperfactory.cxx:34
    ollaboraoffice6.4/program/../program/libwriterfilterlo.so
    
RtfFilter::filter(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>
 const&)
            writerfilter/source/filter/RtfFilter.cxx:152
    
    I.e. we end up in a situation where the insert position does not have a
    containing XText. It's hard to continue from that point and this is in
    the ctor of the dmapper, so we didn't start the import. Just throw an
    exception to avoid further crashes.
    
    Change-Id: Idb5c06186a82c00b838d0b3330260340eb4218b9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123795
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Tested-by: Jenkins
    (cherry picked from commit 05f1990cbdcd99f7ba4863b91a8f1f298b56326a)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123784
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 3af37fc28f59..cc760ccd3756 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -369,6 +369,11 @@ DomainMapper_Impl::DomainMapper_Impl(
 
     appendTableManager( );
     GetBodyText();
+    if (!m_bIsNewDoc && !m_xBodyText)
+    {
+        throw uno::Exception("failed to find body text of the insert 
position", nullptr);
+    }
+
     uno::Reference< text::XTextAppend > xBodyTextAppend( m_xBodyText, 
uno::UNO_QUERY );
     m_aTextAppendStack.push(TextAppendContext(xBodyTextAppend,
                 m_bIsNewDoc ? uno::Reference<text::XTextCursor>() : 
m_xBodyText->createTextCursorByRange(m_xInsertTextRange)));

Reply via email to