[Libreoffice-commits] .: editeng/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Tue Apr 3 15:25:33 PDT 2012
editeng/source/editeng/impedit3.cxx | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
New commits:
commit e5d378b1ba04c470e0c6c16b48af97ab5818e2bb
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Tue Apr 3 18:26:29 2012 -0400
Check for empty-ness of vector before accessing the first element.
I hope this will keep Stephan's tinderbox happy. If not...
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index 83396c9..4e9c393 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 );
More information about the Libreoffice-commits
mailing list