sc/source/ui/navipi/navipi.cxx |   19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

New commits:
commit 6b68ac7d989dd34071c12ee64fe7c4cb99e37c09
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Mon Aug 22 16:38:01 2022 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Mon Aug 22 21:52:50 2022 +0200

    cid#1509273 Unchecked dynamic_cast
    
    get ScDocument the way the rest of ScNavigatorDlg does
    
    Change-Id: Ib1e66a48cc385ac1ad479e8e3b6efa04349116e6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138706
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx
index 44ba8fee2c26..6340c1a80f33 100644
--- a/sc/source/ui/navipi/navipi.cxx
+++ b/sc/source/ui/navipi/navipi.cxx
@@ -126,23 +126,22 @@ namespace
 
 IMPL_LINK(ScNavigatorDlg, ParseRowInputHdl, int*, result, bool)
 {
-    SCCOL nCol;
+    SCCOL nCol(0);
 
     OUString aStrCol = m_xEdCol->get_text();
 
     if (!aStrCol.isEmpty())
     {
-        //  nKeyGroup is no longer set at VCL, in cause of lack of keyinput
+        if (ScViewData* pData = GetViewData())
+        {
+            ScDocument& rDoc = pData->GetDocument();
 
-        ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>( 
SfxViewShell::Current() );
-        auto& rDoc = pViewSh->GetViewData().GetDocument();
-        if ( CharClass::isAsciiNumeric(aStrCol) )
-            nCol = NumStrToAlpha( rDoc.GetSheetLimits(), aStrCol );
-        else
-            nCol = AlphaToNum( rDoc, aStrCol );
+            if ( CharClass::isAsciiNumeric(aStrCol) )
+                nCol = NumStrToAlpha( rDoc.GetSheetLimits(), aStrCol );
+            else
+                nCol = AlphaToNum( rDoc, aStrCol );
+        }
     }
-    else
-        nCol = 0;
 
     *result = nCol;
     return true;

Reply via email to