sc/source/ui/docshell/dbdocfun.cxx |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 5b2ad88bee3a0ff6a52de60beaa6bd78a192f70a
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Wed Jul 17 14:15:29 2024 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Thu Jul 18 07:42:27 2024 +0200

    cid#1606549 Dereference null return value
    
    Change-Id: Ic9c25d9b4ac3d8e368848cb9bbc42f5076bc321f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170631
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    (cherry picked from commit 6449247af9b5509723f2c0e616504b468e2afc49)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170657
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/sc/source/ui/docshell/dbdocfun.cxx 
b/sc/source/ui/docshell/dbdocfun.cxx
index 204854b09764..d3512500037a 100644
--- a/sc/source/ui/docshell/dbdocfun.cxx
+++ b/sc/source/ui/docshell/dbdocfun.cxx
@@ -623,14 +623,14 @@ bool ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& 
rSortParam,
     if (pDBData == rDoc.GetAnonymousDBData( nTab) || 
rDoc.GetDBCollection()->getAnonDBs().has( pDBData))
         pDBData->UpdateFromSortParam( rSortParam);
 
-    if (comphelper::LibreOfficeKit::isActive())
+    if (SfxViewShell* pKitSomeViewForThisDoc = 
comphelper::LibreOfficeKit::isActive() ?
+                                               
rDocShell.GetBestViewShell(false) : nullptr)
     {
-        SfxViewShell* pSomeViewForThisDoc = rDocShell.GetBestViewShell(false);
         SfxViewShell* pViewShell = SfxViewShell::GetFirst();
         while (pViewShell)
         {
             ScTabViewShell* pTabViewShell = 
dynamic_cast<ScTabViewShell*>(pViewShell);
-            if (pTabViewShell && pSomeViewForThisDoc && 
pTabViewShell->GetDocId() == pSomeViewForThisDoc->GetDocId())
+            if (pTabViewShell && pTabViewShell->GetDocId() == 
pKitSomeViewForThisDoc->GetDocId())
             {
                 if (ScPositionHelper* pPosHelper = 
pTabViewShell->GetViewData().GetLOKHeightHelper(nTab))
                     pPosHelper->invalidateByIndex(nStartRow);
@@ -639,7 +639,7 @@ bool ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& 
rSortParam,
         }
 
         ScTabViewShell::notifyAllViewsSheetGeomInvalidation(
-            pSomeViewForThisDoc, false /* bColumns */, true /* bRows */, true 
/* bSizes*/,
+            pKitSomeViewForThisDoc, false /* bColumns */, true /* bRows */, 
true /* bSizes*/,
             true /* bHidden */, true /* bFiltered */, true /* bGroups */, 
nTab);
     }
 

Reply via email to