writerfilter/source/dmapper/DomainMapper_Impl.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 848eb0ddecd4ef4c8da06624a5479efd3d73cf64
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Fri Nov 5 09:42:05 2021 +0000
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Fri Nov 5 13:58:02 2021 +0100

    crashtesting: downgrade assert on bookmark missing from input docx to a 
warning
    
    The docx bugdoc is "generated by ComMA version 3.3.0" and has a pair of
    bookmarkEnd/bookmarkStart in a non-conformant order, like so...
    
    <w:bookmarkEnd w:id="23"/>
    ...
    <w:bookmarkStart w:id="23" w:name="_Toc483311613"/>
    
    both bookmarkStart and bookmarkEnd are mapped to the same
    DomainMapper_Impl::StartOrEndBookmark
    (without a distinction made between begin/end) which assumes the first
    time it's called for an id that it's a bookmark start, and the second
    time for an id that it's a bookmark end and that there will have been a
    w:name seen between the 1st and 2nd calls to be used as the name for the
    bookmark to use at the 2nd call.
    
    That there is no bookmark name is a problem in the input docx rather
    than the import logic so turn this assert into a warning
    
    $ wget https://bugs.documentfoundation.org/attachment.cgi?id=157489 -O 
tdf130241-1.docx
    $ ./instdir/program/soffice --headless --convert-to pdf ./tdf130241-1.docx
    
    https: 
//dev-builds.libreoffice.org/crashtest/b6ef68cdaa51ca5c9fdab40ade97f4a0f18da51b/backtraces/task815-core.backtrace.txt
    Change-Id: Id389d186ea825f515c2638a76c9bba00666e0686
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124734
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 9bc82dfb6c92..dcec98ed59e0 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -7099,7 +7099,7 @@ void DomainMapper_Impl::StartOrEndBookmark( const 
OUString& rId )
                     xCursor->goLeft( 1, false );
                 }
                 uno::Reference< container::XNamed > xBkmNamed( xBookmark, 
uno::UNO_QUERY_THROW );
-                assert(!aBookmarkIter->second.m_sBookmarkName.isEmpty());
+                SAL_WARN_IF(aBookmarkIter->second.m_sBookmarkName.isEmpty(), 
"writerfilter.dmapper", "anonymous bookmark");
                 //todo: make sure the name is not used already!
                 xBkmNamed->setName( aBookmarkIter->second.m_sBookmarkName );
                 xTextAppend->insertTextContent( uno::Reference< 
text::XTextRange >( xCursor, uno::UNO_QUERY_THROW), xBookmark, 
!xCursor->isCollapsed() );

Reply via email to