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.mcnamara@collabora.com>
This commit is contained in:
Caolán McNamara
2024-05-04 15:06:27 +01:00
parent a401e72370
commit 19e1e6185b
11 changed files with 28 additions and 25 deletions

View File

@@ -167,8 +167,11 @@ SvxSearchAttributeDialog::~SvxSearchAttributeDialog()
IMPL_LINK_NOARG(SvxSearchAttributeDialog, OKHdl, weld::Button&, void) IMPL_LINK_NOARG(SvxSearchAttributeDialog, OKHdl, weld::Button&, void)
{ {
DBG_ASSERT( SfxObjectShell::Current(), "No DocShell" ); SfxObjectShell* pObjSh = SfxObjectShell::Current();
SfxItemPool& rPool(SfxObjectShell::Current()->GetPool()); DBG_ASSERT( pObjSh, "No DocShell" );
if (!pObjSh)
return;
SfxItemPool& rPool(pObjSh->GetPool());
for (int i = 0, nCount = m_xAttrLB->n_children(); i < nCount; ++i) for (int i = 0, nCount = m_xAttrLB->n_children(); i < nCount; ++i)
{ {

View File

@@ -503,7 +503,7 @@ void SvxCharNamePage::EnableFeatureButton(const weld::Widget& rNameBox)
void SvxCharNamePage::FillStyleBox_Impl(const weld::Widget& rNameBox) void SvxCharNamePage::FillStyleBox_Impl(const weld::Widget& rNameBox)
{ {
const FontList* pFontList = GetFontList(); const FontList* pFontList = GetFontList();
DBG_ASSERT( pFontList, "no fontlist" ); assert(pFontList && "no fontlist");
FontStyleBox* pStyleBox = nullptr; FontStyleBox* pStyleBox = nullptr;
OUString sFontName; OUString sFontName;

View File

@@ -78,7 +78,7 @@ SvxConnectionPage::SvxConnectionPage(weld::Container* pPage, weld::DialogControl
, m_xCtlPreview(new weld::CustomWeld(*m_xBuilder, "CTL_PREVIEW", m_aCtlPreview)) , m_xCtlPreview(new weld::CustomWeld(*m_xBuilder, "CTL_PREVIEW", m_aCtlPreview))
{ {
SfxItemPool* pPool = rOutAttrs.GetPool(); SfxItemPool* pPool = rOutAttrs.GetPool();
DBG_ASSERT( pPool, "Where is the pool" ); assert(pPool && "Where is the pool");
eUnit = pPool->GetMetric( SDRATTR_EDGENODE1HORZDIST ); eUnit = pPool->GetMetric( SDRATTR_EDGENODE1HORZDIST );
FillTypeLB(); FillTypeLB();

View File

@@ -361,7 +361,7 @@ DeactivateRC SvxGrfCropPage::DeactivatePage(SfxItemSet *_pSet)
IMPL_LINK( SvxGrfCropPage, ZoomHdl, weld::MetricSpinButton&, rField, void ) IMPL_LINK( SvxGrfCropPage, ZoomHdl, weld::MetricSpinButton&, rField, void )
{ {
SfxItemPool* pPool = GetItemSet().GetPool(); SfxItemPool* pPool = GetItemSet().GetPool();
DBG_ASSERT( pPool, "Where is the pool?" ); assert(pPool && "Where is the pool?");
FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhichIDFromSlotID( FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhichIDFromSlotID(
SID_ATTR_GRAF_CROP ) ) ); SID_ATTR_GRAF_CROP ) ) );
@@ -390,7 +390,7 @@ IMPL_LINK( SvxGrfCropPage, ZoomHdl, weld::MetricSpinButton&, rField, void )
IMPL_LINK( SvxGrfCropPage, SizeHdl, weld::MetricSpinButton&, rField, void ) IMPL_LINK( SvxGrfCropPage, SizeHdl, weld::MetricSpinButton&, rField, void )
{ {
SfxItemPool* pPool = GetItemSet().GetPool(); SfxItemPool* pPool = GetItemSet().GetPool();
DBG_ASSERT( pPool, "Where is the pool?" ); assert(pPool && "Where is the pool?");
FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhichIDFromSlotID( FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhichIDFromSlotID(
SID_ATTR_GRAF_CROP ) ) ); SID_ATTR_GRAF_CROP ) ) );
@@ -426,7 +426,7 @@ IMPL_LINK( SvxGrfCropPage, SizeHdl, weld::MetricSpinButton&, rField, void )
IMPL_LINK( SvxGrfCropPage, CropModifyHdl, weld::MetricSpinButton&, rField, void ) IMPL_LINK( SvxGrfCropPage, CropModifyHdl, weld::MetricSpinButton&, rField, void )
{ {
SfxItemPool* pPool = GetItemSet().GetPool(); SfxItemPool* pPool = GetItemSet().GetPool();
DBG_ASSERT( pPool, "Where is the pool?" ); assert(pPool && "Where is the pool?");
FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhichIDFromSlotID( FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhichIDFromSlotID(
SID_ATTR_GRAF_CROP ) ) ); SID_ATTR_GRAF_CROP ) ) );
@@ -511,7 +511,7 @@ IMPL_LINK( SvxGrfCropPage, CropModifyHdl, weld::MetricSpinButton&, rField, void
IMPL_LINK_NOARG(SvxGrfCropPage, OrigSizeHdl, weld::Button&, void) IMPL_LINK_NOARG(SvxGrfCropPage, OrigSizeHdl, weld::Button&, void)
{ {
SfxItemPool* pPool = GetItemSet().GetPool(); SfxItemPool* pPool = GetItemSet().GetPool();
DBG_ASSERT( pPool, "Where is the pool?" ); assert(pPool && "Where is the pool?");
FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhichIDFromSlotID( FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhichIDFromSlotID(
SID_ATTR_GRAF_CROP ) ) ); SID_ATTR_GRAF_CROP ) ) );
@@ -560,7 +560,7 @@ IMPL_LINK_NOARG(SvxGrfCropPage, UncropHdl, weld::Button&, void)
void SvxGrfCropPage::CalcZoom() void SvxGrfCropPage::CalcZoom()
{ {
SfxItemPool* pPool = GetItemSet().GetPool(); SfxItemPool* pPool = GetItemSet().GetPool();
DBG_ASSERT( pPool, "Where is the pool?" ); assert(pPool && "Where is the pool?");
FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhichIDFromSlotID( FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhichIDFromSlotID(
SID_ATTR_GRAF_CROP ) ) ); SID_ATTR_GRAF_CROP ) ) );
@@ -589,7 +589,7 @@ void SvxGrfCropPage::CalcZoom()
void SvxGrfCropPage::CalcMinMaxBorder() void SvxGrfCropPage::CalcMinMaxBorder()
{ {
SfxItemPool* pPool = GetItemSet().GetPool(); SfxItemPool* pPool = GetItemSet().GetPool();
DBG_ASSERT( pPool, "Where is the pool?" ); assert(pPool && "Where is the pool?");
FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhichIDFromSlotID( FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhichIDFromSlotID(
SID_ATTR_GRAF_CROP ) ) ); SID_ATTR_GRAF_CROP ) ) );
tools::Long nR = lcl_GetValue(*m_xRightMF, eUnit ); tools::Long nR = lcl_GetValue(*m_xRightMF, eUnit );
@@ -620,7 +620,7 @@ void SvxGrfCropPage::GraphicHasChanged( bool bFound )
if( bFound ) if( bFound )
{ {
SfxItemPool* pPool = GetItemSet().GetPool(); SfxItemPool* pPool = GetItemSet().GetPool();
DBG_ASSERT( pPool, "Where is the pool?" ); assert(pPool && "Where is the pool?");
FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhichIDFromSlotID( FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhichIDFromSlotID(
SID_ATTR_GRAF_CROP ) )); SID_ATTR_GRAF_CROP ) ));

View File

@@ -137,8 +137,8 @@ void SvxCaptionTabPage::Construct()
bool SvxCaptionTabPage::FillItemSet( SfxItemSet* _rOutAttrs) bool SvxCaptionTabPage::FillItemSet( SfxItemSet* _rOutAttrs)
{ {
SfxItemPool* pPool = _rOutAttrs->GetPool(); SfxItemPool* pPool = _rOutAttrs->GetPool();
DBG_ASSERT( pPool, "Where is the pool?" ); assert(pPool && "Where is the pool?");
MapUnit eUnit; MapUnit eUnit;
@@ -227,7 +227,7 @@ void SvxCaptionTabPage::Reset( const SfxItemSet* )
SetFieldUnit( *m_xMF_LENGTH, eFUnit ); SetFieldUnit( *m_xMF_LENGTH, eFUnit );
SfxItemPool* pPool = rOutAttrs.GetPool(); SfxItemPool* pPool = rOutAttrs.GetPool();
DBG_ASSERT( pPool, "Where is the pool?" ); assert(pPool && "Where is the pool?");
sal_uInt16 nWhich; sal_uInt16 nWhich;
MapUnit eUnit; MapUnit eUnit;

View File

@@ -174,7 +174,7 @@ static sal_uInt16 GetHtmlMode_Impl(const SfxItemSet& rSet)
void SvxStdParagraphTabPage::ELRLoseFocus() void SvxStdParagraphTabPage::ELRLoseFocus()
{ {
SfxItemPool* pPool = GetItemSet().GetPool(); SfxItemPool* pPool = GetItemSet().GetPool();
DBG_ASSERT( pPool, "Where is the pool?" ); assert(pPool && "Where is the pool?");
FieldUnit eUnit = FieldUnit eUnit =
MapToFieldUnit( pPool->GetMetric( GetWhich( SID_ATTR_LRSPACE ) ) ); MapToFieldUnit( pPool->GetMetric( GetWhich( SID_ATTR_LRSPACE ) ) );
@@ -1113,7 +1113,7 @@ void SvxStdParagraphTabPage::Init_Impl()
m_xAutoCB->connect_toggled(LINK(this, SvxStdParagraphTabPage, AutoHdl_Impl)); m_xAutoCB->connect_toggled(LINK(this, SvxStdParagraphTabPage, AutoHdl_Impl));
SfxItemPool* pPool = GetItemSet().GetPool(); 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 ) ) ); FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( GetWhich( SID_ATTR_LRSPACE ) ) );
m_aTopDist.set_max( m_aTopDist.normalize( MAX_DURCH ), eUnit ); m_aTopDist.set_max( m_aTopDist.normalize( MAX_DURCH ), eUnit );

View File

@@ -107,7 +107,7 @@ SvxTextAnimationPage::SvxTextAnimationPage(weld::Container* pPage, weld::DialogC
{ {
eFUnit = GetModuleFieldUnit( rInAttrs ); eFUnit = GetModuleFieldUnit( rInAttrs );
SfxItemPool* pPool = rInAttrs.GetPool(); SfxItemPool* pPool = rInAttrs.GetPool();
DBG_ASSERT( pPool, "Where is the pool?" ); assert(pPool && "Where is the pool?");
eUnit = pPool->GetMetric( SDRATTR_TEXT_LEFTDIST ); eUnit = pPool->GetMetric( SDRATTR_TEXT_LEFTDIST );
m_xLbEffect->connect_changed( LINK( this, SvxTextAnimationPage, SelectEffectHdl_Impl ) ); m_xLbEffect->connect_changed( LINK( this, SvxTextAnimationPage, SelectEffectHdl_Impl ) );

View File

@@ -157,7 +157,7 @@ SvxLineTabPage::SvxLineTabPage(weld::Container* pPage, weld::DialogController* p
// determine PoolUnit // determine PoolUnit
SfxItemPool* pPool = m_rOutAttrs.GetPool(); 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_ePoolUnit = pPool->GetMetric( SID_ATTR_LINE_WIDTH );
m_xLbLineStyle->connect_changed(LINK(this, SvxLineTabPage, ClickInvisibleHdl_Impl)); m_xLbLineStyle->connect_changed(LINK(this, SvxLineTabPage, ClickInvisibleHdl_Impl));

View File

@@ -95,7 +95,7 @@ SvxLineDefTabPage::SvxLineDefTabPage(weld::Container* pPage, weld::DialogControl
// determine PoolUnit // determine PoolUnit
SfxItemPool* pPool = rOutAttrs.GetPool(); SfxItemPool* pPool = rOutAttrs.GetPool();
DBG_ASSERT( pPool, "Where is the pool?" ); assert(pPool && "Where is the pool?");
ePoolUnit = pPool->GetMetric( SID_ATTR_LINE_WIDTH ); ePoolUnit = pPool->GetMetric( SID_ATTR_LINE_WIDTH );
rXLSet.Put( XLineStyleItem(drawing::LineStyle_DASH) ); rXLSet.Put( XLineStyleItem(drawing::LineStyle_DASH) );

View File

@@ -86,7 +86,7 @@ SvxShadowTabPage::SvxShadowTabPage(weld::Container* pPage, weld::DialogControlle
// determine PoolUnit // determine PoolUnit
SfxItemPool* pPool = m_rOutAttrs.GetPool(); SfxItemPool* pPool = m_rOutAttrs.GetPool();
DBG_ASSERT( pPool, "Where is the pool?" ); assert(pPool && "Where is the pool?");
m_ePoolUnit = pPool->GetMetric( SDRATTR_SHADOWXDIST ); m_ePoolUnit = pPool->GetMetric( SDRATTR_SHADOWXDIST );
// setting the output device // setting the output device

View File

@@ -164,7 +164,7 @@ SvxAngleTabPage::SvxAngleTabPage(weld::Container* pPage, weld::DialogController*
{ {
// calculate PoolUnit // calculate PoolUnit
SfxItemPool* pPool = rInAttrs.GetPool(); SfxItemPool* pPool = rInAttrs.GetPool();
DBG_ASSERT( pPool, "no pool (!)" ); assert(pPool && "no pool (!)");
ePoolUnit = pPool->GetMetric(SID_ATTR_TRANSFORM_POS_X); ePoolUnit = pPool->GetMetric(SID_ATTR_TRANSFORM_POS_X);
m_xCtlAngle->SetLinkedField(m_xNfAngle.get(), 2); m_xCtlAngle->SetLinkedField(m_xNfAngle.get(), 2);
@@ -176,7 +176,7 @@ SvxAngleTabPage::~SvxAngleTabPage()
void SvxAngleTabPage::Construct() void SvxAngleTabPage::Construct()
{ {
DBG_ASSERT(pView, "No valid view (!)"); assert(pView && "No valid view (!)");
eDlgUnit = GetModuleFieldUnit(GetItemSet()); eDlgUnit = GetModuleFieldUnit(GetItemSet());
SetFieldUnit(*m_xMtrPosX, eDlgUnit, true); SetFieldUnit(*m_xMtrPosX, eDlgUnit, true);
SetFieldUnit(*m_xMtrPosY, eDlgUnit, true); SetFieldUnit(*m_xMtrPosY, eDlgUnit, true);
@@ -410,7 +410,7 @@ SvxSlantTabPage::~SvxSlantTabPage()
void SvxSlantTabPage::Construct() void SvxSlantTabPage::Construct()
{ {
// get the range // get the range
DBG_ASSERT(pView, "no valid view (!)"); assert(pView && "no valid view (!)");
eDlgUnit = GetModuleFieldUnit(GetItemSet()); eDlgUnit = GetModuleFieldUnit(GetItemSet());
SetFieldUnit(*m_xMtrRadius, eDlgUnit, true); SetFieldUnit(*m_xMtrRadius, eDlgUnit, true);
for (int i = 0; i < 2; ++i) for (int i = 0; i < 2; ++i)
@@ -760,7 +760,7 @@ SvxPositionSizeTabPage::SvxPositionSizeTabPage(weld::Container* pPage, weld::Dia
// evaluate PoolUnit // evaluate PoolUnit
SfxItemPool* pPool = mrOutAttrs.GetPool(); SfxItemPool* pPool = mrOutAttrs.GetPool();
DBG_ASSERT( pPool, "no pool (!)" ); assert(pPool && "no pool (!)");
mePoolUnit = pPool->GetMetric( SID_ATTR_TRANSFORM_POS_X ); mePoolUnit = pPool->GetMetric( SID_ATTR_TRANSFORM_POS_X );
m_aCtlPos.SetActualRP(RectPoint::LT); m_aCtlPos.SetActualRP(RectPoint::LT);
@@ -795,7 +795,7 @@ SvxPositionSizeTabPage::~SvxPositionSizeTabPage()
void SvxPositionSizeTabPage::Construct() void SvxPositionSizeTabPage::Construct()
{ {
// get range and work area // get range and work area
DBG_ASSERT( mpView, "no valid view (!)" ); assert(mpView && "no valid view (!)");
meDlgUnit = GetModuleFieldUnit( GetItemSet() ); meDlgUnit = GetModuleFieldUnit( GetItemSet() );
SetFieldUnit( *m_xMtrPosX, meDlgUnit, true ); SetFieldUnit( *m_xMtrPosX, meDlgUnit, true );
SetFieldUnit( *m_xMtrPosY, meDlgUnit, true ); SetFieldUnit( *m_xMtrPosY, meDlgUnit, true );