summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2012-04-03 18:26:29 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2012-04-03 18:26:29 -0400
commite5d378b1ba04c470e0c6c16b48af97ab5818e2bb (patch)
tree56494c459f85a5cfbd4a93df14055a807c78c3c8
parent86b99ab408c7235604a1a02d7bc531fe5d5f97f6 (diff)
Check for empty-ness of vector before accessing the first element.
I hope this will keep Stephan's tinderbox happy. If not...
-rw-r--r--editeng/source/editeng/impedit3.cxx11
1 files changed, 8 insertions, 3 deletions
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index 83396c90a0c9..4e9c393fa248 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -1241,7 +1241,9 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY )
if ( bCompressedChars && pPortion && ( pPortion->GetLen() > 1 ) && pPortion->GetExtraInfos() && pPortion->GetExtraInfos()->bCompressed )
{
// I need the manipulated DXArray for determining the break postion...
- sal_Int32* pDXArray = &pLine->GetCharPosArray()[0] + (nPortionStart - pLine->GetStart());
+ sal_Int32* pDXArray = NULL;
+ if (!pLine->GetCharPosArray().empty())
+ pDXArray = &pLine->GetCharPosArray()[0] + (nPortionStart - pLine->GetStart());
ImplCalcAsianCompression(
pNode, pPortion, nPortionStart, pDXArray, 10000, true);
}
@@ -2997,7 +2999,8 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta
aText = *pPortion->GetNode();
nTextStart = nIndex;
nTextLen = pTextPortion->GetLen();
- pDXArray = &pLine->GetCharPosArray()[0]+( nIndex-pLine->GetStart() );
+ if (!pLine->GetCharPosArray().empty())
+ pDXArray = &pLine->GetCharPosArray()[0]+( nIndex-pLine->GetStart() );
// Paint control characters (#i55716#)
if ( aStatus.MarkFields() )
@@ -4457,7 +4460,9 @@ void ImpEditEngine::ImplExpandCompressedPortions( EditLine* pLine, ParaPortion*
size_t nTxtPortion = pParaPortion->GetTextPortions().GetPos( pTP );
sal_uInt16 nTxtPortionStart = pParaPortion->GetTextPortions().GetStartPos( nTxtPortion );
DBG_ASSERT( nTxtPortionStart >= pLine->GetStart(), "Portion doesn't belong to the line!!!" );
- sal_Int32* pDXArray = &pLine->GetCharPosArray()[0]+( nTxtPortionStart-pLine->GetStart() );
+ sal_Int32* pDXArray = NULL;
+ if (!pLine->GetCharPosArray().empty())
+ pDXArray = &pLine->GetCharPosArray()[0]+( nTxtPortionStart-pLine->GetStart() );
if ( pTP->GetExtraInfos()->pOrgDXArray )
memcpy( pDXArray, pTP->GetExtraInfos()->pOrgDXArray, (pTP->GetLen()-1)*sizeof(sal_Int32) );
ImplCalcAsianCompression( pParaPortion->GetNode(), pTP, nTxtPortionStart, pDXArray, (sal_uInt16)nCompressPercent, sal_True );