diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-04-03 18:45:55 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-04-03 18:45:55 -0400 |
commit | 71da75abda60172ee9b8f42c1bf5de2f48a731b9 (patch) | |
tree | 69f0682f115e49af6e1211e8a5b8b709dbe45c11 /editeng | |
parent | Check for empty-ness of vector before accessing the first element. (diff) | |
download | core-71da75abda60172ee9b8f42c1bf5de2f48a731b9.tar.gz core-71da75abda60172ee9b8f42c1bf5de2f48a731b9.zip |
I need to check for empty-ness here too.
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/editeng/impedit2.cxx | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index ec74f293c6c6..ecb4a89bf12b 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -4021,7 +4021,9 @@ long ImpEditEngine::GetXPos( if ( nType == CHAR_PUNCTUATIONRIGHT ) { sal_uInt16 n = nIndex - nTextPortionStart; - const sal_Int32* pDXArray = &pLine->GetCharPosArray()[0]+( nTextPortionStart-pLine->GetStart() ); + const sal_Int32* pDXArray = NULL; + if (!pLine->GetCharPosArray().empty()) + pDXArray = &pLine->GetCharPosArray()[0]+( nTextPortionStart-pLine->GetStart() ); sal_Int32 nCharWidth = ( ( (n+1) < pPortion->GetLen() ) ? pDXArray[n] : pPortion->GetSize().Width() ) - ( n ? pDXArray[n-1] : 0 ); if ( (n+1) < pPortion->GetLen() ) |