cui/source/dialogs/srchxtra.cxx  |    7 +++++--
 cui/source/tabpages/chardlg.cxx  |    2 +-
 cui/source/tabpages/connect.cxx  |    2 +-
 cui/source/tabpages/grfpage.cxx  |   14 +++++++-------
 cui/source/tabpages/labdlg.cxx   |    6 +++---
 cui/source/tabpages/paragrph.cxx |    4 ++--
 cui/source/tabpages/textanim.cxx |    2 +-
 cui/source/tabpages/tpline.cxx   |    2 +-
 cui/source/tabpages/tplnedef.cxx |    2 +-
 cui/source/tabpages/tpshadow.cxx |    2 +-
 cui/source/tabpages/transfrm.cxx |   10 +++++-----
 11 files changed, 28 insertions(+), 25 deletions(-)

New commits:
commit 19e1e6185bafc665b3f1ebe0775153a4c71ae84c
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Sat May 4 15:06:27 2024 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Sat May 4 20:29:40 2024 +0200

    WaE: C6011 Dereferencing NULL pointer warnings
    
    Change-Id: I95bc5dae73f6e9a0ae54b1570df51d6d37062695
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167129
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/cui/source/dialogs/srchxtra.cxx b/cui/source/dialogs/srchxtra.cxx
index f8080f537775..9364680f62b2 100644
--- a/cui/source/dialogs/srchxtra.cxx
+++ b/cui/source/dialogs/srchxtra.cxx
@@ -167,8 +167,11 @@ SvxSearchAttributeDialog::~SvxSearchAttributeDialog()
 
 IMPL_LINK_NOARG(SvxSearchAttributeDialog, OKHdl, weld::Button&, void)
 {
-    DBG_ASSERT( SfxObjectShell::Current(), "No DocShell" );
-    SfxItemPool& rPool(SfxObjectShell::Current()->GetPool());
+    SfxObjectShell* pObjSh = SfxObjectShell::Current();
+    DBG_ASSERT( pObjSh, "No DocShell" );
+    if (!pObjSh)
+        return;
+    SfxItemPool& rPool(pObjSh->GetPool());
 
     for (int i = 0, nCount = m_xAttrLB->n_children(); i < nCount; ++i)
     {
diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx
index cd6965375003..ea6ee2ca382b 100644
--- a/cui/source/tabpages/chardlg.cxx
+++ b/cui/source/tabpages/chardlg.cxx
@@ -503,7 +503,7 @@ void SvxCharNamePage::EnableFeatureButton(const 
weld::Widget& rNameBox)
 void SvxCharNamePage::FillStyleBox_Impl(const weld::Widget& rNameBox)
 {
     const FontList* pFontList = GetFontList();
-    DBG_ASSERT( pFontList, "no fontlist" );
+    assert(pFontList && "no fontlist");
 
     FontStyleBox* pStyleBox = nullptr;
     OUString sFontName;
diff --git a/cui/source/tabpages/connect.cxx b/cui/source/tabpages/connect.cxx
index b3d036d991f9..54979804a5bb 100644
--- a/cui/source/tabpages/connect.cxx
+++ b/cui/source/tabpages/connect.cxx
@@ -78,7 +78,7 @@ SvxConnectionPage::SvxConnectionPage(weld::Container* pPage, 
weld::DialogControl
     , m_xCtlPreview(new weld::CustomWeld(*m_xBuilder, "CTL_PREVIEW", 
m_aCtlPreview))
 {
     SfxItemPool* pPool = rOutAttrs.GetPool();
-    DBG_ASSERT( pPool, "Where is the pool" );
+    assert(pPool && "Where is the pool");
     eUnit = pPool->GetMetric( SDRATTR_EDGENODE1HORZDIST );
 
     FillTypeLB();
diff --git a/cui/source/tabpages/grfpage.cxx b/cui/source/tabpages/grfpage.cxx
index 9e96fdbb603c..6ed4d261c1c1 100644
--- a/cui/source/tabpages/grfpage.cxx
+++ b/cui/source/tabpages/grfpage.cxx
@@ -361,7 +361,7 @@ DeactivateRC SvxGrfCropPage::DeactivatePage(SfxItemSet 
*_pSet)
 IMPL_LINK( SvxGrfCropPage, ZoomHdl, weld::MetricSpinButton&, rField, void )
 {
     SfxItemPool* pPool = GetItemSet().GetPool();
-    DBG_ASSERT( pPool, "Where is the pool?" );
+    assert(pPool && "Where is the pool?");
     FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( 
pPool->GetWhichIDFromSlotID(
                                                     SID_ATTR_GRAF_CROP ) ) );
 
@@ -390,7 +390,7 @@ IMPL_LINK( SvxGrfCropPage, ZoomHdl, 
weld::MetricSpinButton&, rField, void )
 IMPL_LINK( SvxGrfCropPage, SizeHdl, weld::MetricSpinButton&, rField, void )
 {
     SfxItemPool* pPool = GetItemSet().GetPool();
-    DBG_ASSERT( pPool, "Where is the pool?" );
+    assert(pPool && "Where is the pool?");
     FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( 
pPool->GetWhichIDFromSlotID(
                                                     SID_ATTR_GRAF_CROP ) ) );
 
@@ -426,7 +426,7 @@ IMPL_LINK( SvxGrfCropPage, SizeHdl, 
weld::MetricSpinButton&, rField, void )
 IMPL_LINK( SvxGrfCropPage, CropModifyHdl, weld::MetricSpinButton&, rField, 
void )
 {
     SfxItemPool* pPool = GetItemSet().GetPool();
-    DBG_ASSERT( pPool, "Where is the pool?" );
+    assert(pPool && "Where is the pool?");
     FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( 
pPool->GetWhichIDFromSlotID(
                                                     SID_ATTR_GRAF_CROP ) ) );
 
@@ -511,7 +511,7 @@ IMPL_LINK( SvxGrfCropPage, CropModifyHdl, 
weld::MetricSpinButton&, rField, void
 IMPL_LINK_NOARG(SvxGrfCropPage, OrigSizeHdl, weld::Button&, void)
 {
     SfxItemPool* pPool = GetItemSet().GetPool();
-    DBG_ASSERT( pPool, "Where is the pool?" );
+    assert(pPool && "Where is the pool?");
     FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( 
pPool->GetWhichIDFromSlotID(
                                                     SID_ATTR_GRAF_CROP ) ) );
 
@@ -560,7 +560,7 @@ IMPL_LINK_NOARG(SvxGrfCropPage, UncropHdl, weld::Button&, 
void)
 void SvxGrfCropPage::CalcZoom()
 {
     SfxItemPool* pPool = GetItemSet().GetPool();
-    DBG_ASSERT( pPool, "Where is the pool?" );
+    assert(pPool && "Where is the pool?");
     FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( 
pPool->GetWhichIDFromSlotID(
                                                     SID_ATTR_GRAF_CROP ) ) );
 
@@ -589,7 +589,7 @@ void SvxGrfCropPage::CalcZoom()
 void SvxGrfCropPage::CalcMinMaxBorder()
 {
     SfxItemPool* pPool = GetItemSet().GetPool();
-    DBG_ASSERT( pPool, "Where is the pool?" );
+    assert(pPool && "Where is the pool?");
     FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( 
pPool->GetWhichIDFromSlotID(
                                                     SID_ATTR_GRAF_CROP ) ) );
     tools::Long nR = lcl_GetValue(*m_xRightMF, eUnit );
@@ -620,7 +620,7 @@ void SvxGrfCropPage::GraphicHasChanged( bool bFound )
     if( bFound )
     {
         SfxItemPool* pPool = GetItemSet().GetPool();
-        DBG_ASSERT( pPool, "Where is the pool?" );
+        assert(pPool && "Where is the pool?");
         FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( 
pPool->GetWhichIDFromSlotID(
                                                     SID_ATTR_GRAF_CROP ) ));
 
diff --git a/cui/source/tabpages/labdlg.cxx b/cui/source/tabpages/labdlg.cxx
index c5661586472c..7e428f7455e7 100644
--- a/cui/source/tabpages/labdlg.cxx
+++ b/cui/source/tabpages/labdlg.cxx
@@ -137,8 +137,8 @@ void SvxCaptionTabPage::Construct()
 
 bool SvxCaptionTabPage::FillItemSet( SfxItemSet*  _rOutAttrs)
 {
-    SfxItemPool*    pPool = _rOutAttrs->GetPool();
-    DBG_ASSERT( pPool, "Where is the pool?" );
+    SfxItemPool* pPool = _rOutAttrs->GetPool();
+    assert(pPool && "Where is the pool?");
 
     MapUnit      eUnit;
 
@@ -227,7 +227,7 @@ void SvxCaptionTabPage::Reset( const SfxItemSet*  )
     SetFieldUnit( *m_xMF_LENGTH, eFUnit );
 
     SfxItemPool*    pPool = rOutAttrs.GetPool();
-    DBG_ASSERT( pPool, "Where is the pool?" );
+    assert(pPool && "Where is the pool?");
 
     sal_uInt16   nWhich;
     MapUnit      eUnit;
diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx
index 98ee3558f0dd..5827a74942ad 100644
--- a/cui/source/tabpages/paragrph.cxx
+++ b/cui/source/tabpages/paragrph.cxx
@@ -174,7 +174,7 @@ static sal_uInt16 GetHtmlMode_Impl(const SfxItemSet& rSet)
 void SvxStdParagraphTabPage::ELRLoseFocus()
 {
     SfxItemPool* pPool = GetItemSet().GetPool();
-    DBG_ASSERT( pPool, "Where is the pool?" );
+    assert(pPool && "Where is the pool?");
     FieldUnit eUnit =
         MapToFieldUnit( pPool->GetMetric( GetWhich( SID_ATTR_LRSPACE ) ) );
 
@@ -1113,7 +1113,7 @@ void SvxStdParagraphTabPage::Init_Impl()
 
     m_xAutoCB->connect_toggled(LINK(this, SvxStdParagraphTabPage, 
AutoHdl_Impl));
     SfxItemPool* pPool = GetItemSet().GetPool();
-    DBG_ASSERT( pPool, "Where is the pool?" );
+    assert(pPool && "Where is the pool?");
     FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( GetWhich( 
SID_ATTR_LRSPACE ) ) );
 
     m_aTopDist.set_max( m_aTopDist.normalize( MAX_DURCH ), eUnit );
diff --git a/cui/source/tabpages/textanim.cxx b/cui/source/tabpages/textanim.cxx
index f0964e4957d6..20faae653cd9 100644
--- a/cui/source/tabpages/textanim.cxx
+++ b/cui/source/tabpages/textanim.cxx
@@ -107,7 +107,7 @@ SvxTextAnimationPage::SvxTextAnimationPage(weld::Container* 
pPage, weld::DialogC
 {
     eFUnit = GetModuleFieldUnit( rInAttrs );
     SfxItemPool* pPool = rInAttrs.GetPool();
-    DBG_ASSERT( pPool, "Where is the pool?" );
+    assert(pPool && "Where is the pool?");
     eUnit = pPool->GetMetric( SDRATTR_TEXT_LEFTDIST );
 
     m_xLbEffect->connect_changed( LINK( this, SvxTextAnimationPage, 
SelectEffectHdl_Impl ) );
diff --git a/cui/source/tabpages/tpline.cxx b/cui/source/tabpages/tpline.cxx
index 1c1635293823..c480e3e6abd9 100644
--- a/cui/source/tabpages/tpline.cxx
+++ b/cui/source/tabpages/tpline.cxx
@@ -157,7 +157,7 @@ SvxLineTabPage::SvxLineTabPage(weld::Container* pPage, 
weld::DialogController* p
 
     // determine PoolUnit
     SfxItemPool* pPool = m_rOutAttrs.GetPool();
-    DBG_ASSERT( pPool, "Where is the pool?" );
+    assert(pPool && "Where is the pool?");
     m_ePoolUnit = pPool->GetMetric( SID_ATTR_LINE_WIDTH );
 
     m_xLbLineStyle->connect_changed(LINK(this, SvxLineTabPage, 
ClickInvisibleHdl_Impl));
diff --git a/cui/source/tabpages/tplnedef.cxx b/cui/source/tabpages/tplnedef.cxx
index c8c180b047e3..677abd7e266a 100644
--- a/cui/source/tabpages/tplnedef.cxx
+++ b/cui/source/tabpages/tplnedef.cxx
@@ -95,7 +95,7 @@ SvxLineDefTabPage::SvxLineDefTabPage(weld::Container* pPage, 
weld::DialogControl
 
     // determine PoolUnit
     SfxItemPool* pPool = rOutAttrs.GetPool();
-    DBG_ASSERT( pPool, "Where is the pool?" );
+    assert(pPool && "Where is the pool?");
     ePoolUnit = pPool->GetMetric( SID_ATTR_LINE_WIDTH );
 
     rXLSet.Put( XLineStyleItem(drawing::LineStyle_DASH) );
diff --git a/cui/source/tabpages/tpshadow.cxx b/cui/source/tabpages/tpshadow.cxx
index ca2bc3b8a574..75d37a9ebb3c 100644
--- a/cui/source/tabpages/tpshadow.cxx
+++ b/cui/source/tabpages/tpshadow.cxx
@@ -86,7 +86,7 @@ SvxShadowTabPage::SvxShadowTabPage(weld::Container* pPage, 
weld::DialogControlle
 
     // determine PoolUnit
     SfxItemPool* pPool = m_rOutAttrs.GetPool();
-    DBG_ASSERT( pPool, "Where is the pool?" );
+    assert(pPool && "Where is the pool?");
     m_ePoolUnit = pPool->GetMetric( SDRATTR_SHADOWXDIST );
 
     // setting the output device
diff --git a/cui/source/tabpages/transfrm.cxx b/cui/source/tabpages/transfrm.cxx
index 78294eb5d584..68cdeed8685e 100644
--- a/cui/source/tabpages/transfrm.cxx
+++ b/cui/source/tabpages/transfrm.cxx
@@ -164,7 +164,7 @@ SvxAngleTabPage::SvxAngleTabPage(weld::Container* pPage, 
weld::DialogController*
 {
     // calculate PoolUnit
     SfxItemPool* pPool = rInAttrs.GetPool();
-    DBG_ASSERT( pPool, "no pool (!)" );
+    assert(pPool && "no pool (!)");
     ePoolUnit = pPool->GetMetric(SID_ATTR_TRANSFORM_POS_X);
 
     m_xCtlAngle->SetLinkedField(m_xNfAngle.get(), 2);
@@ -176,7 +176,7 @@ SvxAngleTabPage::~SvxAngleTabPage()
 
 void SvxAngleTabPage::Construct()
 {
-    DBG_ASSERT(pView, "No valid view (!)");
+    assert(pView && "No valid view (!)");
     eDlgUnit = GetModuleFieldUnit(GetItemSet());
     SetFieldUnit(*m_xMtrPosX, eDlgUnit, true);
     SetFieldUnit(*m_xMtrPosY, eDlgUnit, true);
@@ -410,7 +410,7 @@ SvxSlantTabPage::~SvxSlantTabPage()
 void SvxSlantTabPage::Construct()
 {
     // get the range
-    DBG_ASSERT(pView, "no valid view (!)");
+    assert(pView && "no valid view (!)");
     eDlgUnit = GetModuleFieldUnit(GetItemSet());
     SetFieldUnit(*m_xMtrRadius, eDlgUnit, true);
     for (int i = 0; i < 2; ++i)
@@ -760,7 +760,7 @@ 
SvxPositionSizeTabPage::SvxPositionSizeTabPage(weld::Container* pPage, weld::Dia
 
     // evaluate PoolUnit
     SfxItemPool* pPool = mrOutAttrs.GetPool();
-    DBG_ASSERT( pPool, "no pool (!)" );
+    assert(pPool && "no pool (!)");
     mePoolUnit = pPool->GetMetric( SID_ATTR_TRANSFORM_POS_X );
 
     m_aCtlPos.SetActualRP(RectPoint::LT);
@@ -795,7 +795,7 @@ SvxPositionSizeTabPage::~SvxPositionSizeTabPage()
 void SvxPositionSizeTabPage::Construct()
 {
     // get range and work area
-    DBG_ASSERT( mpView, "no valid view (!)" );
+    assert(mpView && "no valid view (!)");
     meDlgUnit = GetModuleFieldUnit( GetItemSet() );
     SetFieldUnit( *m_xMtrPosX, meDlgUnit, true );
     SetFieldUnit( *m_xMtrPosY, meDlgUnit, true );

Reply via email to