summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2017-12-14 14:34:35 +0100
committerMichael Stahl <mstahl@redhat.com>2017-12-14 15:59:23 +0100
commit8ce353279caa84944971f22ec536433030e5d9c7 (patch)
tree3f89b62bcfc38109d699ec768ccf3320ca7773b9
parent30504139af039d524ca0fd7158fc21ed38db2d9f (diff)
editeng: RTF export: another buggy GetItem2() loop, for fonts
Change-Id: Id25758cba59c1a3ac18ed9a63e73550fea1ee422
-rw-r--r--editeng/source/editeng/impedit4.cxx13
1 files changed, 8 insertions, 5 deletions
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index 000b6eaf56e6..448c6bafaf66 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -315,10 +315,15 @@ ErrCode ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel )
else if ( nScriptType == 2 )
nWhich = EE_CHAR_FONTINFO_CTL;
- sal_uInt32 i = 0;
- const SvxFontItem* pFontItem = static_cast<const SvxFontItem*>(aEditDoc.GetItemPool().GetItem2( nWhich, i ));
- while ( pFontItem )
+ auto const nFonts(aEditDoc.GetItemPool().GetItemCount2(nWhich));
+ for (std::remove_const_t<decltype(nFonts)> i = 0; i < nFonts; ++i)
{
+ SvxFontItem const*const pFontItem = static_cast<const SvxFontItem*>(
+ aEditDoc.GetItemPool().GetItem2(nWhich, i));
+ if (!pFontItem)
+ {
+ continue;
+ }
bool bAlreadyExist = false;
sal_uLong nTestMax = nScriptType ? aFontTable.size() : 1;
for ( sal_uLong nTest = 0; !bAlreadyExist && ( nTest < nTestMax ); nTest++ )
@@ -328,8 +333,6 @@ ErrCode ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel )
if ( !bAlreadyExist )
aFontTable.push_back( new SvxFontItem( *pFontItem ) );
-
- pFontItem = static_cast<const SvxFontItem*>(aEditDoc.GetItemPool().GetItem2( nWhich, ++i ));
}
}