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>
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 1f2c6f9..7d2a1c04 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);