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

New commits:
commit e0b87bf9a34a06d344f4b803c31442c2f723a8ee
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Mon May 6 20:38:54 2024 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Tue May 7 10:21:05 2024 +0200

    cid#1596888 Explicit null dereferenced
    
    Change-Id: I8b6b99a66913a1a6f30046d1cba9fce87d469415
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167249
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Tested-by: Jenkins

diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index f541ca27b679..50d71a589182 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -217,8 +217,9 @@ void 
ScModule::ConfigurationChanged(utl::ConfigurationBroadcaster* p, Configurat
         {
             SfxViewShell* pSfxViewShell = SfxViewShell::Current();
             ScTabViewShell* pViewShell = 
dynamic_cast<ScTabViewShell*>(pSfxViewShell);
+            SfxObjectShell* pCurrentSh = SfxObjectShell::Current();
 
-            if (pViewShell)
+            if (pViewShell && pCurrentSh)
             {
                 ScViewRenderingOptions 
aViewRenderingOptions(pViewShell->GetViewRenderingData());
                 Color 
aFillColor(m_pColorConfig->GetColorValue(svtools::DOCCOLOR).nColor);
@@ -227,9 +228,7 @@ void 
ScModule::ConfigurationChanged(utl::ConfigurationBroadcaster* p, Configurat
                 const bool bUnchanged(aViewRenderingOptions == 
pViewShell->GetViewRenderingData());
                 if (!bUnchanged)
                     pViewShell->SetViewRenderingData(aViewRenderingOptions);
-                ScModelObj* pScModelObj = nullptr;
-                if (SfxObjectShell* pCurrentSh = SfxObjectShell::Current())
-                    pScModelObj = 
comphelper::getFromUnoTunnel<ScModelObj>(pCurrentSh->GetModel());
+                ScModelObj* pScModelObj = 
comphelper::getFromUnoTunnel<ScModelObj>(pCurrentSh->GetModel());
                 SfxLokHelper::notifyViewRenderState(pViewShell, pScModelObj);
                 // In Online, the document color is the one used for the 
background, contrary to
                 // Writer and Draw that use the application background color.

Reply via email to