sw/source/uibase/docvw/edtwin.cxx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
New commits: commit 4cbca5e5f5fc77c3208c4aabab69912d638ec6b4 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Thu Oct 20 11:14:44 2022 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Thu Oct 20 16:35:57 2022 +0200 Resolves: rhbz#2136050 crash on input method "retrieve-surrounding" select the largest graphic on page 1 and press delete Change-Id: Ieb5860d9c3f80df010f4f04e2bace4d9641af315 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141412 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> Tested-by: Jenkins diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 8cc812e17c6a..ef7070fd0245 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -6611,13 +6611,14 @@ Selection SwEditWin::GetSurroundingTextSelection() const if (rSh.HasDrawView() && rSh.GetDrawView()->IsTextEdit()) return rSh.GetDrawView()->GetTextEditOutlinerView()->GetSurroundingTextSelection(); + Selection aSel(0, 0); if( rSh.HasSelection() ) { OUString sReturn; rSh.GetSelectedText( sReturn, ParaBreakType::ToOnlyCR ); - return Selection( 0, sReturn.getLength() ); + aSel = Selection( 0, sReturn.getLength() ); } - else + else if (rSh.GetCursor()->GetPoint()->nNode.GetNode().GetTextNode()) { bool bUnLockView = !rSh.IsViewLocked(); rSh.LockView(true); @@ -6645,8 +6646,10 @@ Selection SwEditWin::GetSurroundingTextSelection() const if (bUnLockView) rSh.LockView(false); - return Selection(sal_Int32(nPos - nStartPos), sal_Int32(nPos - nStartPos)); + aSel = Selection(sal_Int32(nPos - nStartPos), sal_Int32(nPos - nStartPos)); } + + return aSel; } bool SwEditWin::DeleteSurroundingText(const Selection& rSelection)