sw/source/core/crsr/crstrvl.cxx |   11 +++++++++++
 1 file changed, 11 insertions(+)

New commits:
commit ce2cb181b4feea28c97afba6265c9ec1b0f8290c
Author: Michael Stahl <[email protected]>
Date:   Mon Jun 25 16:21:09 2018 +0200

    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 <[email protected]>
    (cherry picked from commit 2bdb926bd6afa01cc3cad013317a1e0ecbde0735)
    Reviewed-on: https://gerrit.libreoffice.org/56411
    Reviewed-by: Thorsten Behrens <[email protected]>

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);
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to