diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-01-10 20:54:08 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-01-12 20:46:39 +0100 |
commit | 75156c3edf90f66a5622e2a81b11079b77ad8952 (patch) | |
tree | a37044cbf186c2e4aae7a4c2dd24c184ff639dc6 /sc | |
parent | e56a6707137c20c3626fc697a08548bd9951e85a (diff) |
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@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/dbgui/tpsubt.cxx | 19 |
1 files changed, 8 insertions, 11 deletions
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 ) ); |