sc/source/ui/app/inputhdl.cxx |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

New commits:
commit 05f663a571212f4785a308346be317b7ebfc062c
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Fri Sep 6 22:41:22 2024 +0200
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Thu Dec 5 11:37:43 2024 +0100

    tdf#162829: Dereference before null check
    
    Regression from:
    commit 1de1c47471278db2344c986e9d597d6a05e559e9
    Author: Gökay Şatır <gokaysa...@gmail.com>
    Date:   Thu Feb 22 13:54:06 2024 +0300
    
        Moving parts of readonly checks from model to view.
    
    Change-Id: I8d0ba914df909bc1a13ce7181b6d05cd0216e468
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172978
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    (cherry picked from commit f42932f23c20122cb7b4537efaf943a8b481752e)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177844
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 06f046346e10..5131639bf7b6 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -3951,7 +3951,7 @@ bool ScInputHandler::KeyInput( const KeyEvent& rKEvt, 
bool bStartEdit /* = false
         UpdateActiveView();
         bool bNewView = DataChanging( nChar );
 
-        if (bProtected || (pActiveViewSh->GetViewShell() && 
pActiveViewSh->GetViewShell()->IsLokReadOnlyView())) // Protected cell?
+        if (bProtected || (pActiveViewSh && pActiveViewSh->GetViewShell() && 
pActiveViewSh->GetViewShell()->IsLokReadOnlyView())) // Protected cell?
             bUsed = true;                           // Don't forward KeyEvent
         else                                        // Changes allowed
         {
@@ -4185,12 +4185,11 @@ void ScInputHandler::InputCommand( const CommandEvent& 
rCEvt )
         UpdateActiveView();
         bool bNewView = DataChanging( 0, true );
 
-        if (!bProtected && !(pActiveViewSh->GetViewShell() && 
pActiveViewSh->GetViewShell()->IsLokReadOnlyView())) // changes allowed
+        if (!bProtected && pActiveViewSh && !(pActiveViewSh->GetViewShell() && 
pActiveViewSh->GetViewShell()->IsLokReadOnlyView())) // changes allowed
         {
             if (bNewView)                           // create new edit view
             {
-                if (pActiveViewSh)
-                    pActiveViewSh->GetViewData().GetDocShell()->PostEditView( 
mpEditEngine.get(), aCursorPos );
+                pActiveViewSh->GetViewData().GetDocShell()->PostEditView( 
mpEditEngine.get(), aCursorPos );
                 UpdateActiveView();
                 if (eMode==SC_INPUT_NONE)
                     if (pTableView || pTopView)

Reply via email to