[Libreoffice-commits] core.git: sw/source

Michael Stahl Michael.Stahl at cib.de
Mon Jun 25 17:04:23 UTC 2018


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

New commits:
commit 2bdb926bd6afa01cc3cad013317a1e0ecbde0735
Author: Michael Stahl <Michael.Stahl at cib.de>
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 <Michael.Stahl at cib.de>

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);


More information about the Libreoffice-commits mailing list