sc/source/core/tool/sharedformula.cxx |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 045765d8b3cd9b00a76e58dfaaffc83422f5fb28
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Sun Sep 5 15:11:04 2021 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Sun Sep 5 18:25:51 2021 +0200

    cid#1491055 Explicit null dereferenced
    
    this always dereferenced pCode so it already assumes pCode cannot be null
    
    Change-Id: I19b601d7f2e089eb2037532590f727c5cd276dd7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121695
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sc/source/core/tool/sharedformula.cxx 
b/sc/source/core/tool/sharedformula.cxx
index 167bd951e226..fa617df53c7a 100644
--- a/sc/source/core/tool/sharedformula.cxx
+++ b/sc/source/core/tool/sharedformula.cxx
@@ -392,17 +392,17 @@ void SharedFormulaUtil::startListeningAsGroup( 
sc::StartListeningContext& rCxt,
     rDoc.SetDetectiveDirty(true);
 
     ScFormulaCellGroupRef xGroup = rTopCell.GetCellGroup();
-    const ScTokenArray* pCode = xGroup->mpCode ? &*xGroup->mpCode : nullptr;
-    assert(pCode == rTopCell.GetCode());
-    if (pCode->IsRecalcModeAlways())
+    const ScTokenArray& rCode = *xGroup->mpCode;
+    assert(&rCode == rTopCell.GetCode());
+    if (rCode.IsRecalcModeAlways())
     {
         rDoc.StartListeningArea(
             BCA_LISTEN_ALWAYS, false,
             xGroup->getAreaListener(ppSharedTop, BCA_LISTEN_ALWAYS, true, 
true));
     }
 
-    formula::FormulaToken** p = pCode->GetCode();
-    formula::FormulaToken** pEnd = p + pCode->GetCodeLen();
+    formula::FormulaToken** p = rCode.GetCode();
+    formula::FormulaToken** pEnd = p + rCode.GetCodeLen();
     for (; p != pEnd; ++p)
     {
         const formula::FormulaToken* t = *p;

Reply via email to