summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2018-06-25 16:21:09 +0200
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2018-06-25 21:34:06 +0200
commitce2cb181b4feea28c97afba6265c9ec1b0f8290c (patch)
treeb6637407372b75be9333cd8bf3f86288e67bdc12
parent8f56cf1f5b29326371b9c29e2b9ccd81ed760941 (diff)
tdf#118219 sw: fix SwCursorShell::GetContentAtPos() redline crash
The problem is that CalcStartEnd() will not return the length of the node, but COMPLETE_STRING if the redline ends in a subsequent node. (regression from 4966b1d4d0dc7bce0a1741f9347dada7406a7fb4) Change-Id: Ic0a27f87b79f68417777842c611c2129fdc9b1f9 Reviewed-on: https://gerrit.libreoffice.org/56402 Tested-by: Jenkins Reviewed-by: Michael Stahl <Michael.Stahl@cib.de> (cherry picked from commit 2bdb926bd6afa01cc3cad013317a1e0ecbde0735) Reviewed-on: https://gerrit.libreoffice.org/56411 Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
-rw-r--r--sw/source/core/crsr/crstrvl.cxx11
1 files changed, 11 insertions, 0 deletions
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index 7c3fd04d256d..7a7d67d4fe86 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -1502,6 +1502,17 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt,
sal_Int32 nStart;
sal_Int32 nEnd;
pRedl->CalcStartEnd(pTextNd->GetIndex(), nStart, nEnd);
+ if (nStart == COMPLETE_STRING)
+ {
+ // consistency: found pRedl, so there must be
+ // something in pTextNd
+ assert(nEnd != COMPLETE_STRING);
+ nStart = 0;
+ }
+ if (nEnd == COMPLETE_STRING)
+ {
+ nEnd = pTextNd->Len();
+ }
//get bounding box of range
SwRect aStart;
pFrame->GetCharRect(aStart, SwPosition(*pTextNd, nStart), &aTmpState);