[Libreoffice-commits] core.git: sw/source

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Sun Oct 4 13:10:48 UTC 2020


 sw/source/filter/ww8/ww8atr.cxx |   20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

New commits:
commit adab4dcb1ea11246f29f43edb2f3c0c588014b2b
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Fri Oct 2 15:27:46 2020 +0200
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sun Oct 4 15:10:05 2020 +0200

    related: tdf#127579: make use of FindCharFormatByName more robust
    
    the same way it's done in WW8AttributeOutput::TextINetFormat
    
    This might fix crashes like
    https://crashreport.libreoffice.org/stats/crash_details/3538a470-23d7-4e37-9504-fe6e81da301b
    unfortunatelly, I have no steps to reproduce it at the moment
    
    Change-Id: I509ee439643dfbaf6f08477142bbbd171e13eed8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103859
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 1f2c6f99364c..7d2a1c0432d3 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -222,11 +222,27 @@ void MSWordExportBase::ExportPoolItemsToCHP( ww8::PoolItems &rItems, sal_uInt16
              if (nWhich == RES_TXTATR_CHARFMT)
              {
                  const SfxPoolItem* pINetItem = SearchPoolItems(rItems, RES_TXTATR_INETFMT);
+
                  if (pINetItem)
                  {
+                     const SwFormatINetFormat& rINet = static_cast<const SwFormatINetFormat&>(*pINetItem);
+
+                     if ( rINet.GetValue().isEmpty() )
+                         continue;
+
+                     const sal_uInt16 nId = rINet.GetINetFormatId();
+                     const OUString& rStr = rINet.GetINetFormat();
+
+                     if (rStr.isEmpty())
+                     {
+                         OSL_ENSURE( false, "MSWordExportBase::ExportPoolItemsToCHP(..) - missing unvisited character format at hyperlink attribute" );
+                     }
+
+                     const SwCharFormat* pINetFormat = IsPoolUserFormat( nId )
+                        ? m_rDoc.FindCharFormatByName( rStr )
+                        : m_rDoc.getIDocumentStylePoolAccess().GetCharFormatFromPool( nId );
+
                      const SwCharFormat* pFormat = static_cast<const SwFormatCharFormat&>(*pItem).GetCharFormat();
-                     const SwCharFormat* pINetFormat = m_rDoc.FindCharFormatByName(
-                         static_cast<const SwFormatINetFormat&>(*pINetItem).GetINetFormat());
                      ww8::PoolItems aCharItems, aINetItems;
                      GetPoolItems(pFormat->GetAttrSet(), aCharItems, false);
                      GetPoolItems(pINetFormat->GetAttrSet(), aINetItems, false);


More information about the Libreoffice-commits mailing list