summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2018-06-25 16:21:09 +0200
committerMichael Stahl <Michael.Stahl@cib.de>2018-06-25 19:04:02 +0200
commit2bdb926bd6afa01cc3cad013317a1e0ecbde0735 (patch)
tree6473ed46e242a1dfaa03980a28d8a21b857dc111
parent276b2f5361a22310896c10523d8e943a316686ae (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>
-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 8976b6ba220a..fe822fc0a7d9 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -1556,6 +1556,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);