summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-02-28 18:53:55 +0000
committerMichael Stahl <michael.stahl@allotropia.de>2021-11-17 17:48:12 +0100
commit06f5b2cfcd3feccc31526f16b3988650e2d07990 (patch)
tree319522a2ea8b4d90a51e5d27aab0718701a20e69
parent6e3f9dd5b31e171247f1701fe86e469ffa74e431 (diff)
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@redhat.com> (cherry picked from commit 58f5c3b07701a14a61dc6b11f959faaf8aa98b9b)
-rw-r--r--sw/source/core/undo/undobj.cxx11
1 files changed, 8 insertions, 3 deletions
diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx
index fa86072a3008..3b1860ecc7c1 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@ -1558,9 +1558,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,