sc/source/ui/app/inputhdl.cxx |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

New commits:
commit b4333d0fed9fc388f837488d68eb5f1473dfbbe1
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Mon Dec 23 17:54:39 2024 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Wed Jan 1 20:33:00 2025 +0100

    crashreporting: check pActiveViewSh
    
    See 
https://crashreport.libreoffice.org/stats/signature/ScInputHandler::UpdateFormulaMode()
    
    This patch also includes
    commit ce67fc823880ac81dbf66f66c97fde21e9e5a733
    Author: Xisco Fauli <xiscofa...@libreoffice.org>
    Date:   Mon Dec 23 21:05:46 2024 +0100
    
        crashreporting: more checks of pActiveViewSh
    
        See 
https://crashreport.libreoffice.org/stats/signature/ScInputHandler::SetMode(ScInputMode,rtl::OUString%20const%20*,ScEditEngineDefaulter%20*)
    
    Change-Id: I87ccb3c07b08ebe0a77b1ebb6a5f4e8c2ea89894
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179259
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Tested-by: Jenkins
    Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179268
    Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 3f5dddadce5f..77ac5e09c896 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -2858,6 +2858,9 @@ void ScInputHandler::UpdateFormulaMode()
 {
     SfxApplication* pSfxApp = SfxGetpApp();
 
+    if (!pActiveViewSh)
+        return;
+
     bool bIsFormula = !bProtected;
     if (bIsFormula)
     {
@@ -2992,18 +2995,20 @@ void ScInputHandler::SetMode( ScInputMode eNewMode, 
const OUString* pInitText, S
     if ( eMode == eNewMode )
         return;
 
+    if (!pActiveViewSh)
+        return;
+
     ImplCreateEditEngine();
 
     if (bProtected)
     {
         eMode = SC_INPUT_NONE;
         StopInputWinEngine( true );
-        if (pActiveViewSh)
-            pActiveViewSh->GetActiveWin()->GrabFocus();
+        pActiveViewSh->GetActiveWin()->GrabFocus();
         return;
     }
 
-    if (eNewMode != SC_INPUT_NONE && pActiveViewSh)
+    if (eNewMode != SC_INPUT_NONE)
         // Disable paste mode when edit mode starts.
         pActiveViewSh->GetViewData().SetPasteMode( ScPasteFlags::NONE );
 
@@ -3020,8 +3025,7 @@ void ScInputHandler::SetMode( ScInputMode eNewMode, const 
OUString* pInitText, S
         {
             if (StartTable(0, false, eMode == SC_INPUT_TABLE, pTopEngine))
             {
-                if (pActiveViewSh)
-                    pActiveViewSh->GetViewData().GetDocShell()->PostEditView( 
mpEditEngine.get(), aCursorPos );
+                pActiveViewSh->GetViewData().GetDocShell()->PostEditView( 
mpEditEngine.get(), aCursorPos );
             }
         }
 

Reply via email to