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

New commits:
commit f42932f23c20122cb7b4537efaf943a8b481752e
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Fri Sep 6 22:41:22 2024 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Sat Sep 7 12:25:33 2024 +0200

    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>

diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index d9210251cc44..95a971a4dd49 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -3940,7 +3940,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
         {
@@ -4174,12 +4174,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