sc/source/ui/unoobj/cellsuno.cxx |   15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

New commits:
commit 2bdf8d96a1356fc74ec271cdbb88954ae0d84240
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Sat Aug 23 12:38:01 2025 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Mon Aug 25 13:44:47 2025 +0200

    This code is dead
    
    If getFromUnoTunnel<SvxUnoTextRangeBase> failed, there's no
    need to test getFromUnoTunnel<ScCellTextCursor>: it is derived
    from SvxUnoTextRangeBase, and will always fail.
    
    Change-Id: I9faac80c6d58ff8d5b84cdb6ab5682ffc06f6b3a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190093
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190162

diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 1f474688a098..15b1fb9314fc 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -5866,20 +5866,13 @@ uno::Reference<text::XTextCursor> SAL_CALL 
ScCellObj::createTextCursorByRange(
                                     const uno::Reference<text::XTextRange>& 
aTextPosition )
 {
     SolarMutexGuard aGuard;
-    rtl::Reference<SvxUnoTextCursor> pCursor = new ScCellTextCursor( *this );
 
     SvxUnoTextRangeBase* pRange = 
comphelper::getFromUnoTunnel<SvxUnoTextRangeBase>( aTextPosition );
-    if(pRange)
-        pCursor->SetSelection( pRange->GetSelection() );
-    else
-    {
-        ScCellTextCursor* pOther = 
comphelper::getFromUnoTunnel<ScCellTextCursor>( aTextPosition );
-        if(!pOther)
-            throw uno::RuntimeException();
-
-        pCursor->SetSelection( pOther->GetSelection() );
+    if (!pRange)
+        throw uno::RuntimeException();
 
-    }
+    rtl::Reference<SvxUnoTextCursor> pCursor = new ScCellTextCursor(*this);
+    pCursor->SetSelection(pRange->GetSelection());
 
     return pCursor;
 }

Reply via email to