[Libreoffice-commits] core.git: sc/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue Jan 12 19:47:17 UTC 2021


 sc/source/ui/dbgui/tpsubt.cxx |   19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

New commits:
commit 75156c3edf90f66a5622e2a81b11079b77ad8952
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun Jan 10 20:54:08 2021 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Jan 12 20:46:39 2021 +0100

    cid#1471553 establish that pViewData will never be null
    
    seeing as these are created from CreateScSubTotalDlg and that
    is always called with a aArgSet containing a ScSubTotalItem
    with a non-null ScViewData set
    
    Change-Id: I1e3d243e4b00d54f9f5015a543556c39d6053f07
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109069
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/source/ui/dbgui/tpsubt.cxx b/sc/source/ui/dbgui/tpsubt.cxx
index a12eff3ba6e9..b5acbc6cdb60 100644
--- a/sc/source/ui/dbgui/tpsubt.cxx
+++ b/sc/source/ui/dbgui/tpsubt.cxx
@@ -73,10 +73,10 @@ void ScTpSubTotalGroup::Init()
     const ScSubTotalItem& rSubTotalItem = static_cast<const ScSubTotalItem&>(
                                           GetItemSet().Get( nWhichSubTotals ));
 
-    pViewData   = rSubTotalItem.GetViewData();
-    pDoc        = pViewData ? &pViewData->GetDocument() : nullptr;
-
-    OSL_ENSURE( pViewData && pDoc, "ViewData or Document not found :-(" );
+    pViewData = rSubTotalItem.GetViewData();
+    assert(pViewData && "CreateScSubTotalDlg aArgSet must contain a ScSubTotalItem with ViewData set");
+    pDoc = &pViewData->GetDocument();
+    assert(pDoc && "Document not found :-(");
 
     mxLbGroup->connect_changed( LINK( this, ScTpSubTotalGroup, SelectListBoxHdl ) );
     mxLbColumns->connect_changed( LINK( this, ScTpSubTotalGroup, SelectTreeListBoxHdl ) );
@@ -244,10 +244,7 @@ bool ScTpSubTotalGroup::DoFillItemSet( sal_uInt16       nGroupNo,
 
 void ScTpSubTotalGroup::FillListBoxes()
 {
-    OSL_ENSURE( pViewData && pDoc, "ViewData or Document not found :-/" );
-
-    if ( !(pViewData && pDoc) )
-        return;
+    assert(pViewData && pDoc && "CreateScSubTotalDlg aArgSet must contain a ScSubTotalItem with ViewData set");
 
     SCCOL   nFirstCol   = rSubTotalData.nCol1;
     SCROW   nFirstRow   = rSubTotalData.nRow1;
@@ -469,9 +466,9 @@ void ScTpSubTotalOptions::Init()
                                           GetItemSet().Get( nWhichSubTotals ));
 
     pViewData   = rSubTotalItem.GetViewData();
-    pDoc        = pViewData ? &pViewData->GetDocument() : nullptr;
-
-    OSL_ENSURE( pViewData && pDoc, "ViewData or Document not found!" );
+    assert(pViewData && "CreateScSubTotalDlg aArgSet must contain a ScSubTotalItem with ViewData set");
+    pDoc = &pViewData->GetDocument();
+    assert(pDoc && "Document not found!");
 
     m_xBtnSort->connect_clicked( LINK( this, ScTpSubTotalOptions, CheckHdl ) );
     m_xBtnUserDef->connect_clicked( LINK( this, ScTpSubTotalOptions, CheckHdl ) );


More information about the Libreoffice-commits mailing list