diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-05-01 12:47:26 +0100 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-05-01 15:29:44 +0200 |
commit | d7790878e315f795f5d9965dd9997ba3a5004c60 (patch) | |
tree | da4260717ea2d78a6e625b14402429663030d103 /basctl | |
parent | ead19f4c62c8d74292a7ba589df2ca118cea3240 (diff) |
WaE: C6011 Dereferencing NULL pointer warnings
Change-Id: I9870360076260e71c0e02375558606cbdb68fc08
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166960
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'basctl')
-rw-r--r-- | basctl/source/basicide/basidesh.cxx | 4 | ||||
-rw-r--r-- | basctl/source/basicide/basobj2.cxx | 2 | ||||
-rw-r--r-- | basctl/source/basicide/basobj3.cxx | 1 | ||||
-rw-r--r-- | basctl/source/dlged/dlged.cxx | 20 | ||||
-rw-r--r-- | basctl/source/dlged/propbrw.cxx | 10 |
5 files changed, 19 insertions, 18 deletions
diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx index bdf68e11a7dc..9f08b9b00a8b 100644 --- a/basctl/source/basicide/basidesh.cxx +++ b/basctl/source/basicide/basidesh.cxx @@ -421,7 +421,7 @@ void Shell::StoreAllWindowData( bool bPersistent ) for (auto const& window : aWindowTable) { BaseWindow* pWin = window.second; - DBG_ASSERT( pWin, "PrepareClose: NULL-Pointer in Table?" ); + assert(pWin && "PrepareClose: NULL-Pointer in Table?"); if ( !pWin->IsSuspended() ) pWin->StoreData(); } @@ -782,7 +782,7 @@ void Shell::RemoveWindow( BaseWindow* pWindow_, bool bDestroy, bool bAllowChange { VclPtr<BaseWindow> pWindowTmp( pWindow_ ); - DBG_ASSERT( pWindow_, "Cannot delete NULL-Pointer!" ); + assert(pWindow_ && "Cannot delete NULL-Pointer!"); sal_uInt16 nKey = GetWindowId( pWindow_ ); pTabBar->RemovePage( nKey ); aWindowTable.erase( nKey ); diff --git a/basctl/source/basicide/basobj2.cxx b/basctl/source/basicide/basobj2.cxx index 708b1ce035d2..0aa3b8b37bf5 100644 --- a/basctl/source/basicide/basobj2.cxx +++ b/basctl/source/basicide/basobj2.cxx @@ -391,7 +391,7 @@ Sequence< OUString > GetMethodNames( const ScriptDocument& rDocument, const OUSt SbMethod* pMethod = static_cast<SbMethod*>(pMod->GetMethods()->Get(i)); if( pMethod->IsHidden() ) continue; - SAL_WARN_IF( !pMethod, "basctl.basicide","Method not found! (NULL)" ); + assert(pMethod && "Method not found! (NULL)"); aSeqMethods.getArray()[ iTarget++ ] = pMethod->GetName(); } } diff --git a/basctl/source/basicide/basobj3.cxx b/basctl/source/basicide/basobj3.cxx index 1e51cbbb2ed8..f8af9e037b60 100644 --- a/basctl/source/basicide/basobj3.cxx +++ b/basctl/source/basicide/basobj3.cxx @@ -116,6 +116,7 @@ SbMethod* CreateMacro( SbModule* pModule, const OUString& rMacroName ) if (aDocument.isValid()) { + assert(pBasic && "isValid cannot be false with !pBasic"); const OUString& aLibName = pBasic->GetName(); const OUString& aModName = pModule->GetName(); OSL_VERIFY( aDocument.updateModule( aLibName, aModName, aOUSource ) ); diff --git a/basctl/source/dlged/dlged.cxx b/basctl/source/dlged/dlged.cxx index 40a7b5c75850..b8f3901eb34b 100644 --- a/basctl/source/dlged/dlged.cxx +++ b/basctl/source/dlged/dlged.cxx @@ -526,28 +526,20 @@ void DlgEditor::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle SdrPageView* pPgView = pDlgEdView->GetSdrPageView(); const vcl::Region aPaintRectRegion(aPaintRect); - // #i74769# - SdrPaintWindow* pTargetPaintWindow = nullptr; - // mark repaint start if (pPgView) { - pTargetPaintWindow = pPgView->GetView().BeginDrawLayers(&rRenderContext, aPaintRectRegion); - OSL_ENSURE(pTargetPaintWindow, "BeginDrawLayers: Got no SdrPaintWindow (!)"); - } + // #i74769# + SdrPaintWindow* pTargetPaintWindow(pPgView->GetView().BeginDrawLayers(&rRenderContext, aPaintRectRegion)); + assert(pTargetPaintWindow && "BeginDrawLayers: Got no SdrPaintWindow (!)"); - // draw background self using wallpaper - // #i79128# ...and use correct OutDev for that - if (pTargetPaintWindow) - { + // draw background self using wallpaper + // #i79128# ...and use correct OutDev for that Color maBackColor = rRenderContext.GetSettings().GetStyleSettings().GetLightColor(); OutputDevice& rTargetOutDev = pTargetPaintWindow->GetTargetOutputDevice(); rTargetOutDev.DrawWallpaper(aPaintRect, Wallpaper(maBackColor)); - } - // do paint (unbuffered) and mark repaint end - if (pPgView) - { + // do paint (unbuffered) and mark repaint end // paint of control layer is done in EndDrawLayers anyway... pPgView->GetView().EndDrawLayers(*pTargetPaintWindow, true); } diff --git a/basctl/source/dlged/propbrw.cxx b/basctl/source/dlged/propbrw.cxx index bb45d5f13e8d..04fa2b3d3b86 100644 --- a/basctl/source/dlged/propbrw.cxx +++ b/basctl/source/dlged/propbrw.cxx @@ -82,11 +82,18 @@ const tools::Long WIN_BORDER = 2; } // namespace +static Reference<XModel> lclGetModel() +{ + if (SfxViewShell* pCurrent = SfxViewShell::Current()) + return pCurrent->GetCurrentDocument(); + return Reference<XModel>(); +} + PropBrw::PropBrw (DialogWindowLayout& rLayout_): DockingWindow(&rLayout_), m_xContentArea(VclPtr<VclVBox>::Create(this)), m_bInitialStateChange(true), - m_xContextDocument(SfxViewShell::Current() ? SfxViewShell::Current()->GetCurrentDocument() : Reference<XModel>()), + m_xContextDocument(lclGetModel()), pView(nullptr) { Size aPropWinSize(STD_WIN_SIZE_X,STD_WIN_SIZE_Y); @@ -241,6 +248,7 @@ Sequence< Reference< XInterface > > for( size_t i = 0 ; i < nMarkCount ; ++i ) { SdrObject* pCurrent = _rMarkList.GetMark(i)->GetMarkedSdrObj(); + assert(pCurrent && "GetMarkedSdrObj will succeed"); std::optional<SdrObjListIter> oGroupIterator; if (pCurrent->IsGroupObject()) |