[Libreoffice-commits] .: editeng/source
Caolán McNamara
caolan at kemper.freedesktop.org
Thu Aug 4 04:54:25 PDT 2011
editeng/source/editeng/impedit2.cxx | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
New commits:
commit ba6440349db1bd688c08369dd2b30f5dd012d339
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Aug 4 12:54:13 2011 +0100
don't assert on an empty paragraph with a start index of 0, that's sane
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index de4296c..a7e8c62 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -1625,11 +1625,12 @@ EditSelection ImpEditEngine::SelectSentence( const EditSelection& rCurSel )
String sParagraph(*pNode);
sParagraph.SearchAndReplaceAll(0x01,0x0a);
//return Null if search starts at the beginning of the string
- long nStart = rPaM.GetIndex() ? _xBI->beginOfSentence( sParagraph, rPaM.GetIndex(), GetLocale( rPaM ) ) : 0;
+ sal_Int32 nStart = rPaM.GetIndex() ? _xBI->beginOfSentence( sParagraph, rPaM.GetIndex(), GetLocale( rPaM ) ) : 0;
- long nEnd = _xBI->endOfSentence( *pNode, rPaM.GetIndex(), GetLocale( rPaM ) );
+ sal_Int32 nEnd = _xBI->endOfSentence( *pNode, rPaM.GetIndex(), GetLocale( rPaM ) );
EditSelection aNewSel( rCurSel );
- OSL_ENSURE(nStart < pNode->Len() && nEnd <= pNode->Len(), "sentence indices out of range");
+ OSL_ENSURE(pNode->Len() ? (nStart < pNode->Len()) : (nStart == 0), "sentence start index out of range");
+ OSL_ENSURE(nEnd <= pNode->Len(), "sentence end index out of range");
aNewSel.Min().SetIndex( (sal_uInt16)nStart );
aNewSel.Max().SetIndex( (sal_uInt16)nEnd );
return aNewSel;
More information about the Libreoffice-commits
mailing list