diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-08-04 12:54:13 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-08-04 12:54:13 +0100 |
commit | b40b45529b509a577c28baf286eba89e8046d440 (patch) | |
tree | b8a8d1f8cf7451ff0dacad9a3aaf56a4ed575025 /editeng | |
parent | 0a3c6b958f6fc184d3f3783ba6511de864a7b8ff (diff) |
don't assert on an empty paragraph with a start index of 0, that's sane
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/editeng/impedit2.cxx | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index fd4f9c795ec3..789caeee3be7 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; |