sc/source/ui/app/inputhdl.cxx |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

New commits:
commit ce67fc823880ac81dbf66f66c97fde21e9e5a733
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Mon Dec 23 21:05:46 2024 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Mon Dec 23 23:28:09 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: Ib0a07f4ee8d7da05960eaac14af561a6b624b0d5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179263
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Tested-by: Jenkins

diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 4da004cd3c01..d62f61f0ef70 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -2866,6 +2866,9 @@ void ScInputHandler::UpdateFormulaMode()
 {
     SfxApplication* pSfxApp = SfxGetpApp();
 
+    if (!pActiveViewSh)
+        return;
+
     bool bIsFormula = !bProtected;
     if (bIsFormula)
     {
@@ -2875,7 +2878,7 @@ void ScInputHandler::UpdateFormulaMode()
 
     if ( bIsFormula )
     {
-        if (!bFormulaMode && pActiveViewSh)
+        if (!bFormulaMode)
         {
             pActiveViewSh->GetViewData().SetEditHighlight(true);
             bFormulaMode = true;
@@ -2999,18 +3002,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 );
 
@@ -3027,8 +3032,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