sw/source/core/undo/undobj.cxx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
New commits: commit 0fec76e0301c839f7fe3a5ba3052038d2ca611c7 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Sun Feb 28 18:53:55 2021 +0000 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Tue Nov 16 10:27:11 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 <caol...@redhat.com> (cherry picked from commit 58f5c3b07701a14a61dc6b11f959faaf8aa98b9b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125232 Tested-by: Michael Stahl <michael.st...@allotropia.de> Reviewed-by: Michael Stahl <michael.st...@allotropia.de> 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,