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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Sun Feb 28 19:46:19 UTC 2021


 sw/source/core/undo/undobj.cxx |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

New commits:
commit 58f5c3b07701a14a61dc6b11f959faaf8aa98b9b
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun Feb 28 18:53:55 2021 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sun Feb 28 20:45:40 2021 +0100

    ofz#31538 null-deref
    
    Change-Id: I3264c0fd509e16cf4727847199f0be316d03d0e8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111713
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx
index cc1f806f1696..a13f87a7786d 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@ -1583,9 +1583,14 @@ static bool IsNotBackspaceHeuristic(
         SwPosition const& rStart, SwPosition const& rEnd)
 {
     // check if the selection is backspace/delete created by DelLeft/DelRight
-    return rStart.nNode.GetIndex() + 1 != rEnd.nNode.GetIndex()
-        || rEnd.nContent != 0
-        || rStart.nContent != rStart.nNode.GetNode().GetTextNode()->Len();
+    if (rStart.nNode.GetIndex() + 1 != rEnd.nNode.GetIndex())
+        return true;
+    if (rEnd.nContent != 0)
+        return true;
+    const SwTextNode* pTextNode = rStart.nNode.GetNode().GetTextNode();
+    if (!pTextNode || rStart.nContent != pTextNode->Len())
+        return true;
+    return false;
 }
 
 bool IsDestroyFrameAnchoredAtChar(SwPosition const & rAnchorPos,


More information about the Libreoffice-commits mailing list