summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2013-10-01 15:14:30 +0100
committerCaolán McNamara <caolanm@redhat.com>2013-10-01 15:16:57 +0100
commit165aca6a01ede62d0ce7577a90709bd9bd43b769 (patch)
tree0010a5084c906a0c017bb218fd2daffcc8f7b505 /editeng
parentd05a9ae25e4a397834330d868b68d92ca919e33b (diff)
Resolves: rhbz#1013480 crash in EditLineList::operator[]
avoid crashing anyway, though unknown how to end up in this scenario Change-Id: Ib602c73478e5c4772cfef73f70c67ad22877a39f
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/editeng/impedit2.cxx9
1 files changed, 6 insertions, 3 deletions
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index d3482191d0d4..515842ee9360 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -4162,10 +4162,13 @@ Rectangle ImpEditEngine::GetEditCursor( ParaPortion* pPortion, sal_uInt16 nIndex
? GetYValue( rLSItem.GetInterLineSpace() ) : 0;
sal_uInt16 nCurIndex = 0;
- OSL_ENSURE( pPortion->GetLines().Count(), "Empty ParaPortion in GetEditCursor!" );
+ size_t nLineCount = pPortion->GetLines().Count();
+ OSL_ENSURE( nLineCount, "Empty ParaPortion in GetEditCursor!" );
+ if (nLineCount == 0)
+ return Rectangle();
const EditLine* pLine = NULL;
sal_Bool bEOL = ( nFlags & GETCRSR_ENDOFLINE ) ? sal_True : sal_False;
- for ( sal_uInt16 nLine = 0; nLine < pPortion->GetLines().Count(); nLine++ )
+ for (size_t nLine = 0; nLine < nLineCount; ++nLine)
{
const EditLine* pTmpLine = pPortion->GetLines()[nLine];
if ( ( pTmpLine->GetStart() == nIndex ) || ( pTmpLine->IsIn( nIndex, bEOL ) ) )
@@ -4184,7 +4187,7 @@ Rectangle ImpEditEngine::GetEditCursor( ParaPortion* pPortion, sal_uInt16 nIndex
// Cursor at the End of the paragraph.
OSL_ENSURE( nIndex == nCurIndex, "Index dead wrong in GetEditCursor!" );
- pLine = pPortion->GetLines()[pPortion->GetLines().Count()-1];
+ pLine = pPortion->GetLines()[nLineCount-1];
nY -= pLine->GetHeight();
if ( !aStatus.IsOutliner() )
nY -= nSBL;