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

New commits:
commit c426d851fd7a66f826d08691d19ff288a636a445
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Fri Oct 2 15:27:46 2020 +0200
Commit:     Michael Stahl <michael.st...@cib.de>
CommitDate: Tue Oct 6 09:42:29 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 <caol...@redhat.com>
    Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103934
    Reviewed-by: Michael Stahl <michael.st...@cib.de>

diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 04f35eb23aaa..e081b730f037 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())
+                     {
+                         SAL_WARN("sw.ww8", 
"MSWordExportBase::ExportPoolItemsToCHP(..) - missing unvisited character 
format at hyperlink attribute" );
+                     }
+
+                     const SwCharFormat* pINetFormat = IsPoolUserFormat( nId )
+                        ? m_pDoc->FindCharFormatByName( rStr )
+                        : 
m_pDoc->getIDocumentStylePoolAccess().GetCharFormatFromPool( nId );
+
                      const SwCharFormat* pFormat = static_cast<const 
SwFormatCharFormat&>(*pItem).GetCharFormat();
-                     const SwCharFormat* pINetFormat = 
m_pDoc->FindCharFormatByName(
-                         static_cast<const 
SwFormatINetFormat&>(*pINetItem).GetINetFormat());
                      ww8::PoolItems aCharItems, aINetItems;
                      GetPoolItems(pFormat->GetAttrSet(), aCharItems, false);
                      GetPoolItems(pINetFormat->GetAttrSet(), aINetItems, 
false);
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to