diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-12-22 15:42:10 +0000 |
---|---|---|
committer | Aron Budea <aron.budea@collabora.com> | 2018-03-14 21:24:10 +0100 |
commit | 69ee2b1cc6969f8850f88c5257df289ccfd88c5d (patch) | |
tree | 75adf6d823d12d5e2488f5407b67d6b88a64ad76 /sw | |
parent | 7bb59a114e7d1419e247b8367ab48265c1b8bc16 (diff) |
avoid crash in 130+ odt export tests
e.g. fdo44181-1.ott to odt
Change-Id: I23403415378ddf50ff007fb4b5d88b4009668bf6
(cherry picked from commit 2085d8203b0ff49b6e43ff900f497fb5343708d8)
(cherry picked from commit 38d2aa02e8b617301f1a7db3831b73572d8b40bf)
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/text/inftxt.cxx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx index 2c577010768e..a6dca7caae37 100644 --- a/sw/source/core/text/inftxt.cxx +++ b/sw/source/core/text/inftxt.cxx @@ -1196,14 +1196,14 @@ void SwTextPaintInfo::DrawBackBrush( const SwLinePortion &rPor ) const nLen = pPos->GetLen(); for ( int i = nIdx; i < (nIdx + nLen); ++i ) { - if ( GetText()[i] == CH_TXTATR_NEWLINE ) + if (i < GetText().getLength() && GetText()[i] == CH_TXTATR_NEWLINE) { if ( i >= (GetIdx() + rPor.GetLen()) ) { goto drawcontinue; } } - if ( GetText()[i] != CH_BLANK ) + if (i >= GetText().getLength() || GetText()[i] != CH_BLANK) { draw = true; if ( i >= (GetIdx() + rPor.GetLen()) ) @@ -1230,11 +1230,11 @@ void SwTextPaintInfo::DrawBackBrush( const SwLinePortion &rPor ) const nLen = pPos->GetLen(); for ( int i = (nIdx + nLen - 1); i >= nIdx; --i ) { - if ( GetText()[i] == CH_TXTATR_NEWLINE ) + if (i < GetText().getLength() && GetText()[i] == CH_TXTATR_NEWLINE) { continue; } - if ( GetText()[i] != CH_BLANK ) + if (i >= GetText().getLength() || GetText()[i] != CH_BLANK) { sal_uInt16 nOldWidth = rPor.Width(); sal_uInt16 nNewWidth = GetTextSize( m_pOut, nullptr, GetText(), nIdx, (i + 1 - nIdx) ).Width(); |