summaryrefslogtreecommitdiff
path: root/sw/source/uibase/docvw
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-10-20 11:14:44 +0100
committerCaolán McNamara <caolanm@redhat.com>2022-10-20 13:13:50 +0200
commit2ba3b81c90688878df4b7aa0d0ff28c9200de0e1 (patch)
tree16dafb2d251765f95605a78c766ddf0e3650a282 /sw/source/uibase/docvw
parent0cc9d19db04fae6e5e1bd4d1020863ec76894300 (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/+/141553 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/source/uibase/docvw')
-rw-r--r--sw/source/uibase/docvw/edtwin.cxx9
1 files changed, 6 insertions, 3 deletions
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index 3b9a556e6912..584d715b9cb8 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -6654,13 +6654,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()->GetNode().GetTextNode())
{
bool bUnLockView = !rSh.IsViewLocked();
rSh.LockView(true);
@@ -6688,8 +6689,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)