sw/source/core/edit/acorrect.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
New commits: commit a1deb4f6f159c1e9cfbde8407399746c1a2ce556 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Thu Feb 21 12:56:57 2019 +0100 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Thu Feb 21 14:11:02 2019 +0100 Make sure that mark does not exceed the length of the text Change-Id: I685d3ac7f7038ef91463b2a0f012e23f0d6a422e Reviewed-on: https://gerrit.libreoffice.org/68147 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/sw/source/core/edit/acorrect.cxx b/sw/source/core/edit/acorrect.cxx index 9c0858e744dc..6a32448dd082 100644 --- a/sw/source/core/edit/acorrect.cxx +++ b/sw/source/core/edit/acorrect.cxx @@ -380,17 +380,15 @@ bool SwAutoCorrDoc::ChgAutoCorrWord( sal_Int32& rSttPos, sal_Int32 nEndPos, pTextNd->getLayoutFrame(rEditSh.GetLayout()))); assert(pFrame); - //JP 22.04.99: Bug 63883 - Special treatment for dots. - bool bLastCharIsPoint = nEndPos < pFrame->GetText().getLength() && - ('.' == pFrame->GetText()[nEndPos]); - + const OUString sFrameText = pFrame->GetText(); const SvxAutocorrWord* pFnd = rACorrect.SearchWordsInList( - pFrame->GetText(), rSttPos, nEndPos, *this, aLanguageTag); + sFrameText, rSttPos, nEndPos, *this, aLanguageTag); SwDoc* pDoc = rEditSh.GetDoc(); if( pFnd ) { // replace also last colon of keywords surrounded by colons (for example, ":name:") - bool replaceLastChar = pFnd->GetShort()[0] == ':' && pFnd->GetShort().endsWith(":"); + const bool replaceLastChar = sFrameText.getLength() > nEndPos && pFnd->GetShort()[0] == ':' + && pFnd->GetShort().endsWith(":"); SwPaM aPam(pFrame->MapViewToModelPos(TextFrameIndex(rSttPos)), pFrame->MapViewToModelPos(TextFrameIndex(nEndPos + (replaceLastChar ? 1 : 0)))); @@ -398,6 +396,8 @@ bool SwAutoCorrDoc::ChgAutoCorrWord( sal_Int32& rSttPos, sal_Int32 nEndPos, if( pFnd->IsTextOnly() ) { //JP 22.04.99: Bug 63883 - Special treatment for dots. + const bool bLastCharIsPoint + = nEndPos < sFrameText.getLength() && ('.' == sFrameText[nEndPos]); if( !bLastCharIsPoint || pFnd->GetLong().isEmpty() || '.' != pFnd->GetLong()[ pFnd->GetLong().getLength() - 1 ] ) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits