diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-10-02 15:27:46 +0200 |
---|---|---|
committer | Michael Stahl <michael.stahl@cib.de> | 2020-10-06 09:42:29 +0200 |
commit | c426d851fd7a66f826d08691d19ff288a636a445 (patch) | |
tree | f7071b4be765df7aa5a9494ff095ef0ca2a6caab /sw | |
parent | d471c802e8a3a4299e122cc05900bdab6ed67a00 (diff) |
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@redhat.com>
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103934
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/filter/ww8/ww8atr.cxx | 20 |
1 files changed, 18 insertions, 2 deletions
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); |