desktop/source/pkgchk/unopkg/unopkg_misc.cxx                 |    2 +-
 desktop/source/pkgchk/unopkg/unopkg_shared.h                 |    2 +-
 sd/source/core/PageListWatcher.cxx                           |    2 +-
 sd/source/ui/accessibility/AccessibleViewForwarder.cxx       |    4 ++--
 sd/source/ui/app/sdmod2.cxx                                  |    1 +
 sd/source/ui/dlg/dlgolbul.cxx                                |    2 +-
 sd/source/ui/dlg/dlgsnap.cxx                                 |    2 +-
 sd/source/ui/dlg/sdtreelb.cxx                                |    2 +-
 sd/source/ui/dlg/tpoption.cxx                                |    2 +-
 sd/source/ui/func/fuexecuteinteraction.cxx                   |    2 ++
 sd/source/ui/func/fuexpand.cxx                               |    2 +-
 sd/source/ui/func/fuinsfil.cxx                               |    2 +-
 sd/source/ui/func/fulinend.cxx                               |    1 +
 sd/source/ui/func/funavig.cxx                                |    1 +
 sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx |    2 +-
 sd/source/ui/slidesorter/view/SlsToolTip.cxx                 |    6 +++---
 sd/source/ui/table/tablefunction.cxx                         |    2 +-
 sd/source/ui/uitest/uiobject.cxx                             |    2 +-
 sd/source/ui/view/DocumentRenderer.cxx                       |    4 ++--
 sd/source/ui/view/Outliner.cxx                               |    2 +-
 sd/source/ui/view/drbezob.cxx                                |    1 +
 sd/source/ui/view/viewshe2.cxx                               |    4 ++--
 sd/source/ui/view/viewshel.cxx                               |    2 +-
 23 files changed, 29 insertions(+), 23 deletions(-)

New commits:
commit 39ca26c6705d1544b7007bf930c9e862c0aa4b25
Author:     Caolán McNamara <[email protected]>
AuthorDate: Mon May 6 21:08:29 2024 +0100
Commit:     Caolán McNamara <[email protected]>
CommitDate: Tue May 7 11:15:52 2024 +0200

    WaE: C6011 Dereferencing NULL pointer warnings
    
    Change-Id: I3f13b457025280486d6cb4d2935c1ef5a52b0637
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167250
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/sd/source/core/PageListWatcher.cxx 
b/sd/source/core/PageListWatcher.cxx
index c3d8846fc77f..236b7a83ed31 100644
--- a/sd/source/core/PageListWatcher.cxx
+++ b/sd/source/core/PageListWatcher.cxx
@@ -37,7 +37,7 @@ void ImpPageListWatcher::ImpRecreateSortedPageListOnDemand()
     for(sal_uInt32 a(0); a < nPageCount; a++)
     {
         SdPage* pCandidate = ImpGetPage(a);
-        DBG_ASSERT(pCandidate, 
"ImpPageListWatcher::ImpRecreateSortedPageListOnDemand: Invalid PageList in 
Model (!)");
+        assert(pCandidate && 
"ImpPageListWatcher::ImpRecreateSortedPageListOnDemand: Invalid PageList in 
Model (!)");
 
         switch(pCandidate->GetPageKind())
         {
diff --git a/sd/source/ui/accessibility/AccessibleViewForwarder.cxx 
b/sd/source/ui/accessibility/AccessibleViewForwarder.cxx
index d28e69217ec2..af489866fd4e 100644
--- a/sd/source/ui/accessibility/AccessibleViewForwarder.cxx
+++ b/sd/source/ui/accessibility/AccessibleViewForwarder.cxx
@@ -74,7 +74,7 @@ AccessibleViewForwarder::~AccessibleViewForwarder()
 */
 Point AccessibleViewForwarder::LogicToPixel(const Point& rPoint) const
 {
-    OSL_ASSERT(mpView != nullptr);
+    assert(mpView != nullptr);
     if (static_cast<sal_uInt32>(mnWindowId) < mpView->PaintWindowCount())
     {
         SdrPaintWindow* pPaintWindow = 
mpView->GetPaintWindow(static_cast<sal_uInt32>(mnWindowId));
@@ -88,7 +88,7 @@ Point AccessibleViewForwarder::LogicToPixel(const Point& 
rPoint) const
 
 Size AccessibleViewForwarder::LogicToPixel(const Size& rSize) const
 {
-    OSL_ASSERT(mpView != nullptr);
+    assert(mpView != nullptr);
     if (static_cast<sal_uInt32>(mnWindowId) < mpView->PaintWindowCount())
     {
         SdrPaintWindow* pPaintWindow = 
mpView->GetPaintWindow(static_cast<sal_uInt32>(mnWindowId));
diff --git a/sd/source/ui/app/sdmod2.cxx b/sd/source/ui/app/sdmod2.cxx
index d1d2d2998778..55b7d43ba3dc 100644
--- a/sd/source/ui/app/sdmod2.cxx
+++ b/sd/source/ui/app/sdmod2.cxx
@@ -498,6 +498,7 @@ std::optional<SfxItemSet> SdModule::CreateItemSet( 
sal_uInt16 nSlot )
     sal_Int32  nY;
     if( pDocSh )
     {
+        assert(pDoc);
         SdrPage* pPage = pDoc->GetSdPage(0, PageKind::Standard);
         Size aSize(pPage->GetSize());
         nW = aSize.Width();
diff --git a/sd/source/ui/dlg/dlgolbul.cxx b/sd/source/ui/dlg/dlgolbul.cxx
index ac1d4f7b4099..7207ba5bc6e9 100644
--- a/sd/source/ui/dlg/dlgolbul.cxx
+++ b/sd/source/ui/dlg/dlgolbul.cxx
@@ -96,7 +96,7 @@ OutlineBulletDlg::OutlineBulletDlg(weld::Window* pParent, 
const SfxItemSet* pAtt
         if( pItem == nullptr )
             pItem = 
m_aInputSet.GetPool()->GetSecondaryPool()->GetUserDefaultItem(EE_PARA_NUMBULLET);
 
-        DBG_ASSERT( pItem, "No EE_PARA_NUMBULLET in Pool! [CL]" );
+        assert(pItem && "No EE_PARA_NUMBULLET in Pool! [CL]");
 
         m_aInputSet.Put(pItem->CloneSetWhich(EE_PARA_NUMBULLET));
     }
diff --git a/sd/source/ui/dlg/dlgsnap.cxx b/sd/source/ui/dlg/dlgsnap.cxx
index 9f16a5fa5394..c2d752850aec 100644
--- a/sd/source/ui/dlg/dlgsnap.cxx
+++ b/sd/source/ui/dlg/dlgsnap.cxx
@@ -61,7 +61,7 @@ SdSnapLineDlg::SdSnapLineDlg(weld::Window* pWindow, const 
SfxItemSet& rInAttrs,
 
     // determine PoolUnit
     SfxItemPool* pPool = rInAttrs.GetPool();
-    DBG_ASSERT( pPool, "Where's the Pool?" );
+    assert(pPool && "Where's the Pool?");
     MapUnit ePoolUnit = pPool->GetMetric( SID_ATTR_FILL_HATCH );
 
     // #i48497# Consider page origin
diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx
index 9883ad847ae0..b1928e52d764 100644
--- a/sd/source/ui/dlg/sdtreelb.cxx
+++ b/sd/source/ui/dlg/sdtreelb.cxx
@@ -1219,7 +1219,7 @@ void SdPageObjsTLV::AddShapeList (
     while( aIter.IsMore() )
     {
         SdrObject* pObj = aIter.Next();
-        OSL_ASSERT(pObj!=nullptr);
+        assert(pObj!=nullptr);
 
         // Get the shape name.
         OUString aStr (GetObjectName( pObj ) );
diff --git a/sd/source/ui/dlg/tpoption.cxx b/sd/source/ui/dlg/tpoption.cxx
index 39f04d15a915..fb16a14bebaf 100644
--- a/sd/source/ui/dlg/tpoption.cxx
+++ b/sd/source/ui/dlg/tpoption.cxx
@@ -382,7 +382,7 @@ SdTpOptionsMisc::SdTpOptionsMisc(weld::Container* pPage, 
weld::DialogController*
 
     // determine PoolUnit
     SfxItemPool* pPool = rInAttrs.GetPool();
-    DBG_ASSERT( pPool, "Where is the Pool?" );
+    assert(pPool && "Where is the Pool?");
     ePoolUnit = pPool->GetMetric( SID_ATTR_FILL_HATCH );
 
     // Fill the CB
diff --git a/sd/source/ui/func/fuexecuteinteraction.cxx 
b/sd/source/ui/func/fuexecuteinteraction.cxx
index 6dacef089d56..0970740f06cf 100644
--- a/sd/source/ui/func/fuexecuteinteraction.cxx
+++ b/sd/source/ui/func/fuexecuteinteraction.cxx
@@ -78,6 +78,8 @@ void FuExecuteInteraction::DoExecute(SfxRequest&)
         || dynamic_cast<const DrawView*>(mpView) == nullptr)
         return;
 
+    assert(mpDocSh);
+
     SdAnimationInfo* pInfo = SdDrawDocument::GetAnimationInfo(pObj);
     if (!pInfo)
         return;
diff --git a/sd/source/ui/func/fuexpand.cxx b/sd/source/ui/func/fuexpand.cxx
index 822174ed94b4..17e0e0fed1ad 100644
--- a/sd/source/ui/func/fuexpand.cxx
+++ b/sd/source/ui/func/fuexpand.cxx
@@ -104,7 +104,7 @@ void FuExpandPage::DoExecute( SfxRequest& )
 
     if (pActualOutline)
     {
-        const bool bUndo = mpView->IsUndoEnabled();
+        const bool bUndo = mpView && mpView->IsUndoEnabled();
 
         if( bUndo )
             mpView->BegUndo(SdResId(STR_UNDO_EXPAND_PAGE));
diff --git a/sd/source/ui/func/fuinsfil.cxx b/sd/source/ui/func/fuinsfil.cxx
index 790c3d0c8d00..20d52abd26ec 100644
--- a/sd/source/ui/func/fuinsfil.cxx
+++ b/sd/source/ui/func/fuinsfil.cxx
@@ -581,7 +581,7 @@ void FuInsertFile::InsTextOrRTFinOlMode(SfxMedium* pMedium)
     aOutliner.SetPaperSize(Size(0x7fffffff, 0x7fffffff));
 
     SvStream* pStream = pMedium->GetInStream();
-    DBG_ASSERT( pStream, "No InStream!" );
+    assert(pStream && "No InStream!");
     pStream->Seek( 0 );
 
     ErrCode nErr = aOutliner.Read(*pStream, pMedium->GetBaseURL(), nFormat, 
mpDocSh->GetHeaderAttributes());
diff --git a/sd/source/ui/func/fulinend.cxx b/sd/source/ui/func/fulinend.cxx
index 088e8e9d24c2..629c18935023 100644
--- a/sd/source/ui/func/fulinend.cxx
+++ b/sd/source/ui/func/fulinend.cxx
@@ -57,6 +57,7 @@ void FuLineEnd::DoExecute( SfxRequest& )
         return;
 
     const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+    assert(pObj);
     const SdrObject* pNewObj;
     rtl::Reference<SdrObject> pConvPolyObj;
 
diff --git a/sd/source/ui/func/funavig.cxx b/sd/source/ui/func/funavig.cxx
index a160d94c7140..ca7565c8ba49 100644
--- a/sd/source/ui/func/funavig.cxx
+++ b/sd/source/ui/func/funavig.cxx
@@ -56,6 +56,7 @@ rtl::Reference<FuPoor> FuNavigation::Create( ViewShell* 
pViewSh, ::sd::Window* p
 
 void FuNavigation::DoExecute( SfxRequest& rReq )
 {
+    assert(mpViewShell);
     bool bSlideShow = SlideShow::IsRunning( mpViewShell->GetViewShellBase() )
         && !SlideShow::IsInteractiveSlideshow( 
&mpViewShell->GetViewShellBase() ); // IASS
 
diff --git a/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx 
b/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx
index 1af2abcabfc7..e57a82ec8150 100644
--- a/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx
@@ -586,7 +586,7 @@ void SelectionFunction::GotoNextPage (int nOffset)
     if (pDescriptor)
     {
         SdPage* pPage = pDescriptor->GetPage();
-        OSL_ASSERT(pPage!=nullptr);
+        assert(pPage!=nullptr);
         sal_Int32 nIndex = (pPage->GetPageNum()-1) / 2;
         GotoPage(nIndex + nOffset);
     }
diff --git a/sd/source/ui/slidesorter/view/SlsToolTip.cxx 
b/sd/source/ui/slidesorter/view/SlsToolTip.cxx
index 0bd9917e2619..24cf35d35ce4 100644
--- a/sd/source/ui/slidesorter/view/SlsToolTip.cxx
+++ b/sd/source/ui/slidesorter/view/SlsToolTip.cxx
@@ -120,10 +120,10 @@ void ToolTip::DoShow()
     if (aBox.Bottom() >= pWindow->GetSizePixel().Height())
         return;
 
-    vcl::Window* pParent (pWindow);
-    while (pParent!=nullptr && pParent->GetParent()!=nullptr)
+    vcl::Window* pParent(pWindow);
+    while (pParent->GetParent())
         pParent = pParent->GetParent();
-    const Point aOffset 
(pWindow->GetWindowExtentsRelative(*pParent).TopLeft());
+    const Point aOffset(pWindow->GetWindowExtentsRelative(*pParent).TopLeft());
 
     // We do not know how high the tool tip will be but want its top
     // edge not its bottom to be at a specific position (a little below
diff --git a/sd/source/ui/table/tablefunction.cxx 
b/sd/source/ui/table/tablefunction.cxx
index 1277a712426a..642a4b77d453 100644
--- a/sd/source/ui/table/tablefunction.cxx
+++ b/sd/source/ui/table/tablefunction.cxx
@@ -221,7 +221,7 @@ void DrawViewShell::FuTable(SfxRequest& rReq)
 
         rReq.Ignore();
         SfxViewShell* pViewShell = GetViewShell();
-        OSL_ASSERT (pViewShell!=nullptr);
+        assert(pViewShell!=nullptr);
         SfxBindings& rBindings = pViewShell->GetViewFrame().GetBindings();
         rBindings.Invalidate( SID_INSERT_TABLE, true );
         break;
diff --git a/sd/source/ui/uitest/uiobject.cxx b/sd/source/ui/uitest/uiobject.cxx
index 2c96b9495b14..352c82d70e20 100644
--- a/sd/source/ui/uitest/uiobject.cxx
+++ b/sd/source/ui/uitest/uiobject.cxx
@@ -137,7 +137,7 @@ void ImpressWindowUIObject::execute(const OUString& 
rAction, const StringMap& rP
     else if (rAction == "SIDEBAR")
     {
         SfxViewFrame* pViewFrm = SfxViewFrame::Current();
-        DBG_ASSERT(pViewFrm, "ImpressWindowUIObject::execute: no viewframe");
+        assert(pViewFrm && "ImpressWindowUIObject::execute: no viewframe");
         pViewFrm->ShowChildWindow(SID_SIDEBAR);
 
         auto itr = rParameters.find("PANEL");
diff --git a/sd/source/ui/view/DocumentRenderer.cxx 
b/sd/source/ui/view/DocumentRenderer.cxx
index a8d5a6f1de25..39bbbd84fa6f 100644
--- a/sd/source/ui/view/DocumentRenderer.cxx
+++ b/sd/source/ui/view/DocumentRenderer.cxx
@@ -1253,7 +1253,7 @@ public:
             return;
 
         SdDrawDocument* pDocument = pViewShell->GetDoc();
-        OSL_ASSERT(pDocument!=nullptr);
+        assert(pDocument!=nullptr);
 
         std::shared_ptr<DrawViewShell> pDrawViewShell(
             
std::dynamic_pointer_cast<DrawViewShell>(mrBase.GetMainViewShell()));
@@ -1741,7 +1741,7 @@ private:
     void PrepareHandout (PrintInfo& rInfo)
     {
         SdDrawDocument* pDocument = mrBase.GetDocument();
-        OSL_ASSERT(pDocument != nullptr);
+        assert(pDocument != nullptr);
         SdPage& rHandoutPage (*pDocument->GetSdPage(0, PageKind::Handout));
 
         const bool bScalePage (mpOptions->IsPageSize());
diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx
index cd499d787149..131f4cb54a42 100644
--- a/sd/source/ui/view/Outliner.cxx
+++ b/sd/source/ui/view/Outliner.cxx
@@ -1695,7 +1695,7 @@ bool SdOutliner::HasNoPreviousMatch()
 {
     OutlinerView* pOutlinerView = getOutlinerView();
 
-    DBG_ASSERT (pOutlinerView!=nullptr, "outline view in 
SdOutliner::HasNoPreviousMatch is NULL");
+    assert(pOutlinerView && "outline view in SdOutliner::HasNoPreviousMatch is 
NULL");
 
     // Detect whether the cursor stands at the beginning
     // resp. at the end of the text.
diff --git a/sd/source/ui/view/drbezob.cxx b/sd/source/ui/view/drbezob.cxx
index 0db363aa21b2..197bc22c0019 100644
--- a/sd/source/ui/view/drbezob.cxx
+++ b/sd/source/ui/view/drbezob.cxx
@@ -207,6 +207,7 @@ void BezierObjectBar::Execute(SfxRequest& rReq)
         case SID_BEZIER_SYMMTR:
         case SID_BEZIER_CLOSE:
         {
+            assert(mpView);
             const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
 
             IPolyPolygonEditorController* pIPPEC = nullptr;
diff --git a/sd/source/ui/view/viewshe2.cxx b/sd/source/ui/view/viewshe2.cxx
index 18658fc8c929..e669afd65dbe 100644
--- a/sd/source/ui/view/viewshe2.cxx
+++ b/sd/source/ui/view/viewshe2.cxx
@@ -614,7 +614,7 @@ void ViewShell::SetZoomFactor(const Fraction& rZoomX, const 
Fraction&)
 void ViewShell::SetActiveWindow (::sd::Window* pWin)
 {
     SfxViewShell* pViewShell = GetViewShell();
-    OSL_ASSERT (pViewShell!=nullptr);
+    assert(pViewShell!=nullptr);
 
     if (pViewShell->GetWindow() != pWin)
     {
@@ -694,7 +694,7 @@ bool ViewShell::ActivateObject(SdrOle2Obj* pObj, sal_Int32 
nVerb)
     bool bAbort = false;
     GetDocSh()->SetWaitCursor( true );
     SfxViewShell* pViewShell = GetViewShell();
-    OSL_ASSERT (pViewShell!=nullptr);
+    assert(pViewShell!=nullptr);
     bool bChangeDefaultsForChart = false;
 
     uno::Reference < embed::XEmbeddedObject > xObj = pObj->GetObjRef();
diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx
index b341c8a29d85..11afe137b7af 100644
--- a/sd/source/ui/view/viewshel.cxx
+++ b/sd/source/ui/view/viewshel.cxx
@@ -333,7 +333,7 @@ void ViewShell::Activate(bool bIsMDIActivate)
         }
 
         SfxViewShell* pViewShell = GetViewShell();
-        OSL_ASSERT (pViewShell!=nullptr);
+        assert(pViewShell!=nullptr);
         SfxBindings& rBindings = pViewShell->GetViewFrame().GetBindings();
         rBindings.Invalidate( SID_3D_STATE, true );
 
commit db68bf7859f79676cd7addb2565e6ce0fbf4e570
Author:     Caolán McNamara <[email protected]>
AuthorDate: Mon May 6 20:25:58 2024 +0100
Commit:     Caolán McNamara <[email protected]>
CommitDate: Tue May 7 11:15:44 2024 +0200

    WaE: C6011 Dereferencing NULL pointer warnings
    
    Change-Id: Iaef14644b8d9fa0c26de39871e9352d5d79ebb08
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167248
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx 
b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx
index ba49544f0fec..051ed782e38a 100644
--- a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx
+++ b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx
@@ -142,7 +142,7 @@ bool readArgument(
     {
         if (*pIndex < osl_getCommandArgCount())
         {
-            OSL_ASSERT( pValue != nullptr );
+            assert(pValue != nullptr);
             osl_getCommandArg( *pIndex, &pValue->pData );
             dp_misc::TRACE(__FILE__ ": argument value: "
                 + *pValue + "
");
diff --git a/desktop/source/pkgchk/unopkg/unopkg_shared.h 
b/desktop/source/pkgchk/unopkg/unopkg_shared.h
index 21d0f6a92856..ac8322629093 100644
--- a/desktop/source/pkgchk/unopkg/unopkg_shared.h
+++ b/desktop/source/pkgchk/unopkg/unopkg_shared.h
@@ -67,7 +67,7 @@ inline bool readOption(
     bool * flag, OptionInfo const * option_info, sal_uInt32 * pIndex )
 {
     if (isOption( option_info, pIndex )) {
-        OSL_ASSERT( flag != nullptr );
+        assert(flag != nullptr);
         *flag = true;
         return true;
     }

Reply via email to