diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-10-20 11:14:44 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-10-20 16:35:57 +0200 |
commit | 4cbca5e5f5fc77c3208c4aabab69912d638ec6b4 (patch) | |
tree | a4d5b5b5dc279efa79270178e1c0dbf70fcbf5af /sw | |
parent | cc76bafdd1b8b4d03f549785b368e80b9c409c86 (diff) |
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.stahl@allotropia.de>
Tested-by: Jenkins
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/uibase/docvw/edtwin.cxx | 9 |
1 files changed, 6 insertions, 3 deletions
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) |