summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-08-04 12:54:13 +0100
committerCaolán McNamara <caolanm@redhat.com>2011-08-04 12:54:13 +0100
commitba6440349db1bd688c08369dd2b30f5dd012d339 (patch)
tree94a17e6814195ef915d42b44814953fdbf7701fa
parent9bfb43a942afd567cbb82edeba60c4cacc85c646 (diff)
don't assert on an empty paragraph with a start index of 0, that's sane
-rw-r--r--editeng/source/editeng/impedit2.cxx7
1 files changed, 4 insertions, 3 deletions
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index de4296cf26..a7e8c62425 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;