sw/source/core/edit/acorrect.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
New commits: commit 4309ae909514e219a7e7aa8febced141d1baa83e Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Thu Feb 21 12:56:57 2019 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Fri Mar 15 11:44:14 2019 +0100 tdf#123624: 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> (cherry picked from commit a1deb4f6f159c1e9cfbde8407399746c1a2ce556) Reviewed-on: https://gerrit.libreoffice.org/69280 Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/source/core/edit/acorrect.cxx b/sw/source/core/edit/acorrect.cxx index eaf61bec0451..283a3f7dbd9c 100644 --- a/sw/source/core/edit/acorrect.cxx +++ b/sw/source/core/edit/acorrect.cxx @@ -381,17 +381,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)))); @@ -399,6 +397,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