package/source/xstor/xstorage.cxx                       |   14 +++---
 sw/source/core/access/accpara.cxx                       |    2 
 sw/source/core/access/acctable.cxx                      |    7 +--
 sw/source/core/crsr/crstrvl.cxx                         |    2 
 sw/source/core/doc/DocumentContentOperationsManager.cxx |    1 
 sw/source/core/doc/DocumentFieldsManager.cxx            |    2 
 sw/source/core/doc/docdraw.cxx                          |    3 +
 sw/source/core/doc/docfmt.cxx                           |    1 
 sw/source/core/doc/doclay.cxx                           |    2 
 sw/source/core/doc/docredln.cxx                         |   12 +++--
 sw/source/core/doc/docsort.cxx                          |    4 -
 sw/source/core/doc/doctxm.cxx                           |    2 
 sw/source/core/doc/htmltbl.cxx                          |    2 
 sw/source/core/doc/notxtfrm.cxx                         |    2 
 sw/source/core/doc/swserv.cxx                           |    1 
 sw/source/core/doc/tblcpy.cxx                           |    3 -
 sw/source/core/doc/tblrwcl.cxx                          |    8 ++-
 sw/source/core/docnode/ndsect.cxx                       |    2 
 sw/source/core/docnode/ndtbl.cxx                        |    2 
 sw/source/core/docnode/ndtbl1.cxx                       |    2 
 sw/source/core/docnode/node.cxx                         |    1 
 sw/source/core/docnode/nodes.cxx                        |    7 +--
 sw/source/core/docnode/section.cxx                      |    4 -
 sw/source/core/draw/dview.cxx                           |    3 -
 sw/source/core/edit/autofmt.cxx                         |    7 +++
 sw/source/core/edit/editsh.cxx                          |    2 
 sw/source/core/edit/edsect.cxx                          |    2 
 sw/source/core/edit/edtox.cxx                           |    2 
 sw/source/core/fields/expfld.cxx                        |    2 
 sw/source/core/frmedt/fecopy.cxx                        |    4 +
 sw/source/core/frmedt/fefly1.cxx                        |    2 
 uui/source/secmacrowarnings.cxx                         |    2 
 vcl/jsdialog/jsdialogbuilder.cxx                        |    2 
 vcl/source/bitmap/Vectorizer.cxx                        |    2 
 vcl/source/control/fmtfield.cxx                         |    1 
 vcl/source/edit/texteng.cxx                             |    2 
 vcl/source/gdi/regionband.cxx                           |    2 
 vcl/source/helper/strhelper.cxx                         |    2 
 vcl/source/outdev/bitmapex.cxx                          |    4 -
 vcl/source/outdev/text.cxx                              |    1 
 vcl/source/treelist/svimpbox.cxx                        |    2 
 vcl/source/treelist/transfer.cxx                        |    3 -
 vcl/source/treelist/treelist.cxx                        |   35 ++++++++--------
 vcl/source/window/builder.cxx                           |    2 
 vcl/source/window/printdlg.cxx                          |    2 
 vcl/source/window/scrwnd.cxx                            |    2 
 46 files changed, 104 insertions(+), 70 deletions(-)

New commits:
commit 8662a96c90b56f61bf24380094f217e7170f54be
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Thu May 2 17:57:22 2024 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Fri May 3 09:17:09 2024 +0200

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

diff --git a/package/source/xstor/xstorage.cxx 
b/package/source/xstor/xstorage.cxx
index d394052c01ce..1abfdf89be4a 100644
--- a/package/source/xstor/xstorage.cxx
+++ b/package/source/xstor/xstorage.cxx
@@ -1416,7 +1416,7 @@ SotElement_Impl* OStorage_Impl::InsertElement( const 
OUString& aName, bool bIsSt
 
 void OStorage_Impl::OpenSubStorage( SotElement_Impl* pElement, sal_Int32 
nStorageMode )
 {
-    SAL_WARN_IF( !pElement, "package.xstor", "pElement is not set!" );
+    assert(pElement && "pElement is not set!");
     SAL_WARN_IF( !pElement->m_bIsStorage, "package.xstor", "Storage flag is 
not set!" );
 
     ::osl::MutexGuard aGuard( m_xMutex->GetMutex() );
@@ -1437,7 +1437,7 @@ void OStorage_Impl::OpenSubStorage( SotElement_Impl* 
pElement, sal_Int32 nStorag
 
 void OStorage_Impl::OpenSubStream( SotElement_Impl* pElement )
 {
-    SAL_WARN_IF( !pElement, "package.xstor", "pElement is not set!" );
+    assert(pElement && "pElement is not set!");
     SAL_WARN_IF( pElement->m_bIsStorage, "package.xstor", "Storage flag is 
set!" );
 
     ::osl::MutexGuard aGuard( m_xMutex->GetMutex() );
@@ -1985,7 +1985,7 @@ SotElement_Impl* OStorage::OpenStreamElement_Impl( const 
OUString& aStreamName,
         throw io::IOException( THROW_WHERE );
     }
 
-    SAL_WARN_IF( !pElement, "package.xstor", "In case element can not be 
created an exception must be thrown!" );
+    assert(pElement && "In case element can not be created an exception must 
be thrown!");
 
     if (!pElement->m_xStream)
         m_pImpl->OpenSubStream( pElement );
@@ -2231,7 +2231,7 @@ uno::Reference< io::XStream > SAL_CALL 
OStorage::openStreamElement(
     try
     {
         SotElement_Impl *pElement = OpenStreamElement_Impl( aStreamName, 
nOpenMode, false );
-        OSL_ENSURE(pElement && pElement->m_xStream, "In case element can not 
be created an exception must be thrown!");
+        assert(pElement && pElement->m_xStream && "In case element can not be 
created an exception must be thrown!");
 
         xResult = pElement->m_xStream->GetStream(nOpenMode, false);
         SAL_WARN_IF( !xResult.is(), "package.xstor", "The method must throw 
exception instead of removing empty result!" );
@@ -3120,7 +3120,7 @@ uno::Reference< io::XStream > SAL_CALL 
OStorage::openEncryptedStream(
     try
     {
         SotElement_Impl *pElement = OpenStreamElement_Impl( aStreamName, 
nOpenMode, true );
-        OSL_ENSURE(pElement && pElement->m_xStream, "In case element can not 
be created an exception must be thrown!");
+        assert(pElement && pElement->m_xStream && "In case element can not be 
created an exception must be thrown!");
 
         xResult = pElement->m_xStream->GetStream(nOpenMode, aEncryptionData, 
false);
         SAL_WARN_IF( !xResult.is(), "package.xstor", "The method must throw 
exception instead of removing empty result!" );
@@ -4930,7 +4930,7 @@ void SAL_CALL OStorage::insertStreamElementDirect(
             throw container::ElementExistException( THROW_WHERE );
 
         pElement = OpenStreamElement_Impl( aStreamName, 
embed::ElementModes::READWRITE, false );
-        OSL_ENSURE(pElement && pElement->m_xStream, "In case element can not 
be created an exception must be thrown!");
+        assert(pElement && pElement->m_xStream && "In case element can not be 
created an exception must be thrown!");
 
         pElement->m_xStream->InsertStreamDirectly(xInStream, aProps);
     }
@@ -5464,7 +5464,7 @@ uno::Reference< embed::XExtendedStorageStream > SAL_CALL 
OStorage::openEncrypted
         // the transacted version of the stream should be opened
 
         SotElement_Impl *pElement = OpenStreamElement_Impl( aStreamPath, 
nOpenMode, true );
-        OSL_ENSURE(pElement && pElement->m_xStream, "In case element can not 
be created an exception must be thrown!");
+        assert(pElement && pElement->m_xStream && "In case element can not be 
created an exception must be thrown!");
 
         xResult.set(pElement->m_xStream->GetStream(nOpenMode, aEncryptionData, 
true),
                     uno::UNO_QUERY_THROW);
diff --git a/sw/source/core/access/accpara.cxx 
b/sw/source/core/access/accpara.cxx
index c6565a522671..12b3ce9b0f4f 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -461,7 +461,7 @@ void SwAccessibleParagraph::ExecuteAtViewShell( sal_uInt16 
nSlot )
     OSL_ENSURE( GetMap() != nullptr, "no map?" );
     SwViewShell* pViewShell = GetMap()->GetShell();
 
-    OSL_ENSURE( pViewShell != nullptr, "View shell expected!" );
+    assert(pViewShell != nullptr && "View shell expected!");
     SfxViewShell* pSfxShell = pViewShell->GetSfxViewShell();
 
     OSL_ENSURE( pSfxShell != nullptr, "SfxViewShell shell expected!" );
diff --git a/sw/source/core/access/acctable.cxx 
b/sw/source/core/access/acctable.cxx
index d58a8b74b1ae..e60b47a339c6 100644
--- a/sw/source/core/access/acctable.cxx
+++ b/sw/source/core/access/acctable.cxx
@@ -1276,7 +1276,6 @@ void SAL_CALL SwAccessibleTable::selectAccessibleChild(
 
     // preliminaries: get 'our' table box, and get the cursor shell
     const SwTableBox* pBox = GetTableBox( nChildIndex );
-    OSL_ENSURE( pBox != nullptr, "We need the table box." );
 
     SwCursorShell* pCursorShell = GetCursorShell();
     if( pCursorShell == nullptr )
@@ -1284,9 +1283,9 @@ void SAL_CALL SwAccessibleTable::selectAccessibleChild(
 
     // assure, that child, identified by the given index, isn't already 
selected.
     if ( IsChildSelected( nChildIndex ) )
-    {
         return;
-    }
+
+    assert(pBox != nullptr && "We need the table box.");
 
     // now we can start to do the work: check whether we already have
     // a table selection (in 'our' table). If so, extend the
@@ -1445,7 +1444,7 @@ void SAL_CALL SwAccessibleTable::deselectAccessibleChild(
         return;
 
     const SwTableBox* pBox = GetTableBox( nChildIndex );
-    OSL_ENSURE( pBox != nullptr, "We need the table box." );
+    assert(pBox != nullptr && "We need the table box.");
 
     // If we unselect point, then set cursor to mark. If we clear another
     // selected box, then set cursor to point.
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index 2abfb959a46d..c758b970ddae 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -738,7 +738,7 @@ bool SwCursorShell::MoveFieldType(
         const SwPosition& rPos = *pCursor->GetPoint();
 
         SwTextNode* pTNd = rPos.GetNode().GetTextNode();
-        OSL_ENSURE( pTNd, "No ContentNode" );
+        assert(pTNd && "No ContentNode");
 
         SwTextField * pTextField = 
pTNd->GetFieldTextAttrAt(rPos.GetContentIndex(), 
::sw::GetTextAttrMode::Default);
         const bool bDelField = ( pTextField == nullptr );
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index d065af3a60a5..d0eef8abe8b0 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -3914,6 +3914,7 @@ void DocumentContentOperationsManager::CopyWithFlyInFly(
                 sw::RecreateStartTextFrames(*pNode);
                 if (!frames.empty())
                 {   // tdf#132187 check if the end node needs new frames
+                    assert(pEndNode);
                     SwIterator<SwTextFrame, SwTextNode, 
sw::IteratorMode::UnwrapMulti> aIter(*pEndNode);
                     for (SwTextFrame* pFrame = aIter.First(); pFrame; pFrame = 
aIter.Next())
                     {
diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx 
b/sw/source/core/doc/DocumentFieldsManager.cxx
index 3b5888b34122..f58d3f6982af 100644
--- a/sw/source/core/doc/DocumentFieldsManager.cxx
+++ b/sw/source/core/doc/DocumentFieldsManager.cxx
@@ -494,7 +494,7 @@ void DocumentFieldsManager::PutValueToField(const 
SwPosition & rPos,
 bool DocumentFieldsManager::UpdateField(SwTextField* pDstTextField, SwField& 
rSrcField, bool bUpdateFields)
 {
     //static const sw::RefmarkFieldUpdate aRefMarkHint;
-    OSL_ENSURE(pDstTextField, "no field to update!");
+    assert(pDstTextField && "no field to update!");
 
     bool bTableSelBreak = false;
 
diff --git a/sw/source/core/doc/docdraw.cxx b/sw/source/core/doc/docdraw.cxx
index 1a3bed4e4c0c..862945fb3bd5 100644
--- a/sw/source/core/doc/docdraw.cxx
+++ b/sw/source/core/doc/docdraw.cxx
@@ -224,6 +224,8 @@ SwDrawContact* SwDoc::GroupSelection( SdrView& rDrawView )
             if (!pContact)
                 continue;
 
+            assert(pObj);
+
             // #i53320#
 #if OSL_DEBUG_LEVEL > 0
             SwAnchoredDrawObject* pAnchoredDrawObj =
@@ -503,6 +505,7 @@ bool SwDoc::DeleteSelection( SwDrawView& rDrawView )
                 {
                     const SdrMark& rMark = *rMrkList.GetMark( i );
                     pObj = rMark.GetMarkedSdrObj();
+                    assert(pObj);
                     SwDrawContact *pContact = 
static_cast<SwDrawContact*>(pObj->GetUserCall());
                     if( pContact ) // of course not for grouped objects
                     {
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 5c77223c8538..97321edb1912 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -711,6 +711,7 @@ void SwDoc::DelCharFormat( SwCharFormat const *pFormat, 
bool bBroadcast )
 
 void SwDoc::DelFrameFormat( SwFrameFormat *pFormat, bool bBroadcast )
 {
+    assert(pFormat && "ContainsFormat will always deref pFormat");
     if( dynamic_cast<const SwTableBoxFormat*>( pFormat) != nullptr || 
dynamic_cast<const SwTableLineFormat*>( pFormat) != nullptr )
     {
         OSL_ENSURE( false, "Format is not in the DocArray any more, "
diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx
index f6994fb76c6b..0371bd66ce7f 100644
--- a/sw/source/core/doc/doclay.cxx
+++ b/sw/source/core/doc/doclay.cxx
@@ -682,7 +682,7 @@ lcl_InsertLabel(SwDoc & rDoc, SwTextFormatColls *const 
pTextFormatCollTable,
             // The Frame is created automatically.
             {
                 SwStartNode *pSttNd = rDoc.GetNodes()[nNdIdx]->GetStartNode();
-                OSL_ENSURE( pSttNd, "No StartNode in InsertLabel." );
+                assert(pSttNd && "No StartNode in InsertLabel.");
                 SwNodeOffset nNode;
                 if( bBefore )
                 {
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index a629d9d6b432..b5a022d8effc 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -210,8 +210,10 @@ bool SwExtraRedlineTable::DeleteTableRowRedline( SwDoc* 
pDoc, const SwTableLine&
     {
         SwExtraRedline* pExtraRedline = GetRedline(nCurRedlinePos);
         const SwTableRowRedline* pTableRowRedline = dynamic_cast<const 
SwTableRowRedline*>(pExtraRedline);
-        const SwTableLine *pRedTabLine = pTableRowRedline ? 
&pTableRowRedline->GetTableLine() : nullptr;
-        if ( pRedTabLine == &rTableLine )
+        if (!pTableRowRedline)
+            continue;
+        const SwTableLine& rRedTabLine = pTableRowRedline->GetTableLine();
+        if ( &rRedTabLine == &rTableLine )
         {
             // Redline for this table row
             const SwRedlineData& aRedlineData = 
pTableRowRedline->GetRedlineData();
@@ -254,8 +256,10 @@ bool SwExtraRedlineTable::DeleteTableCellRedline( SwDoc* 
pDoc, const SwTableBox&
     {
         SwExtraRedline* pExtraRedline = GetRedline(nCurRedlinePos);
         const SwTableCellRedline* pTableCellRedline = dynamic_cast<const 
SwTableCellRedline*>(pExtraRedline);
-        const SwTableBox *pRedTabBox = pTableCellRedline ? 
&pTableCellRedline->GetTableBox() : nullptr;
-        if ( pRedTabBox == &rTableBox )
+        if (!pTableCellRedline)
+            continue;
+        const SwTableBox& rRedTabBox = pTableCellRedline->GetTableBox();
+        if (&rRedTabBox == &rTableBox)
         {
             // Redline for this table cell
             const SwRedlineData& aRedlineData = 
pTableCellRedline->GetRedlineData();
diff --git a/sw/source/core/doc/docsort.cxx b/sw/source/core/doc/docsort.cxx
index ed1ffdad0d3b..5be48cdedd30 100644
--- a/sw/source/core/doc/docsort.cxx
+++ b/sw/source/core/doc/docsort.cxx
@@ -237,7 +237,7 @@ OUString SwSortBoxElement::GetKey(sal_uInt16 nKey) const
     if( pFndBox )
     {   // Get StartNode and skip it
         const SwTableBox* pMyBox = pFndBox->GetBox();
-        OSL_ENSURE(pMyBox, "No atomic Box");
+        assert(pMyBox && "No atomic Box");
 
         if( pMyBox->GetSttNd() )
         {
@@ -674,7 +674,7 @@ void MoveCol(SwDoc* pDoc, const FlatFndBox& rBox, 
sal_uInt16 nS, sal_uInt16 nT,
 void MoveCell(SwDoc* pDoc, const SwTableBox* pSource, const SwTableBox* pTar,
               bool bMovedBefore, SwUndoSort* pUD)
 {
-    OSL_ENSURE(pSource && pTar,"Source or target missing");
+    assert(pSource && pTar && "Source or target missing");
 
     if(pSource == pTar)
         return;
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index da790cc3dd7b..613f68773493 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -474,7 +474,7 @@ const SwAttrSet& SwDoc::GetTOXBaseAttrSet(const SwTOXBase& 
rTOXBase)
     assert( dynamic_cast<const SwTOXBaseSection*>( &rTOXBase) && "no 
TOXBaseSection!" );
     const SwTOXBaseSection& rTOXSect = static_cast<const 
SwTOXBaseSection&>(rTOXBase);
     SwSectionFormat const * pFormat = rTOXSect.GetFormat();
-    OSL_ENSURE( pFormat, "invalid TOXBaseSection!" );
+    assert(pFormat && "invalid TOXBaseSection!");
     return pFormat->GetAttrSet();
 }
 
diff --git a/sw/source/core/doc/htmltbl.cxx b/sw/source/core/doc/htmltbl.cxx
index 4711a123ad0f..9829eb41310e 100644
--- a/sw/source/core/doc/htmltbl.cxx
+++ b/sw/source/core/doc/htmltbl.cxx
@@ -408,7 +408,7 @@ const SwStartNode *SwHTMLTableLayout::GetAnyBoxStartNode() 
const
 SwFrameFormat *SwHTMLTableLayout::FindFlyFrameFormat() const
 {
     const SwTableNode *pTableNd = GetAnyBoxStartNode()->FindTableNode();
-    OSL_ENSURE( pTableNd, "No Table-Node?" );
+    assert(pTableNd && "No Table-Node?");
     return pTableNd->GetFlyFormat();
 }
 
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index 0255ff8b358c..e7720afea697 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -1161,7 +1161,7 @@ void SwNoTextFrame::PaintPicture( vcl::RenderContext* 
pOut, const SwRect &rGrfAr
 
             // #i99665#
             // Adjust AntiAliasing mode at output device for chart OLE
-            if ( pOLENd->IsChart() )
+            if (pOLENd && pOLENd->IsChart())
                 nNewAntialiasingAtOutput |= 
AntialiasingFlags::PixelSnapHairline;
 
             pOut->SetAntialiasing( nNewAntialiasingAtOutput );
diff --git a/sw/source/core/doc/swserv.cxx b/sw/source/core/doc/swserv.cxx
index b12ab6b6c15c..582a3564b0d8 100644
--- a/sw/source/core/doc/swserv.cxx
+++ b/sw/source/core/doc/swserv.cxx
@@ -214,6 +214,7 @@ bool SwServerObject::IsLinkInServer( const SwBaseLink* 
pChkLnk ) const
 
     if( nSttNd && nEndNd )
     {
+        assert(pNds);
         // Get LinkManager
         const ::sfx2::SvBaseLinks& rLnks = 
pNds->GetDoc().getIDocumentLinksAdministration().GetLinkManager().GetLinks();
 
diff --git a/sw/source/core/doc/tblcpy.cxx b/sw/source/core/doc/tblcpy.cxx
index f1ff236fd60c..903488787ec2 100644
--- a/sw/source/core/doc/tblcpy.cxx
+++ b/sw/source/core/doc/tblcpy.cxx
@@ -426,6 +426,7 @@ namespace
                     if( rInfo.mbSelected || nCol > nCurrStartCol )
                     {
                         rInfo.mpCopy = pCurrBox->mpBox;
+                        assert(rInfo.mpCopy);
                         if( rInfo.mbSelected && rInfo.mpCopy->getDummyFlag() )
                         {
                             ++pCurrBox;
@@ -711,7 +712,7 @@ bool SwTable::InsTable( const SwTable& rCpyTable, const 
SwNodeIndex& rSttBox,
     SwTableBox* pMyBox = GetTableBox(
             rSttBox.GetNode().FindTableBoxStartNode()->GetIndex() );
 
-    OSL_ENSURE( pMyBox, "Index is not in a Box in this Table" );
+    assert(pMyBox && "Index is not in a Box in this Table");
 
     // First delete the Table's Frames
     FndBox_ aFndBox( nullptr, nullptr );
diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx
index bdc3de520976..b13dc38ebcef 100644
--- a/sw/source/core/doc/tblrwcl.cxx
+++ b/sw/source/core/doc/tblrwcl.cxx
@@ -582,6 +582,8 @@ bool SwTable::InsertRow_( SwDoc* pDoc, const SwSelBoxes& 
rBoxes,
     else
         aCpyPara.nDelBorderFlag = 2;
 
+    assert(pDoc);
+
     for( sal_uInt16 nCpyCnt = 0; nCpyCnt < nCnt; ++nCpyCnt )
     {
         if( bBehind )
@@ -2920,7 +2922,7 @@ static void SetLineHeight( SwTableLine& rLine, SwTwips 
nOldHeight, SwTwips nNewH
                     bool bMinSize )
 {
     SwLayoutFrame* pLineFrame = GetRowFrame( rLine );
-    OSL_ENSURE( pLineFrame, "Where is the Frame from the SwTableLine?" );
+    assert(pLineFrame && "Where is the Frame from the SwTableLine?");
 
     SwFrameFormat* pFormat = rLine.ClaimFrameFormat();
 
@@ -2983,7 +2985,7 @@ static bool lcl_SetOtherLineHeight( SwTableLine* pLine, 
const CR_SetLineHeight&
         {
             // Calculate the new relative size by means of the old one
             SwLayoutFrame* pLineFrame = GetRowFrame( *pLine );
-            OSL_ENSURE( pLineFrame, "Where is the Frame from the SwTableLine?" 
);
+            assert(pLineFrame && "Where is the Frame from the SwTableLine?");
 
             if( TableChgMode::FixedWidthChangeProp == rParam.nMode )
             {
@@ -3000,7 +3002,7 @@ static bool lcl_SetOtherLineHeight( SwTableLine* pLine, 
const CR_SetLineHeight&
         if( TableChgMode::FixedWidthChangeProp == rParam.nMode )
         {
             SwLayoutFrame* pLineFrame = GetRowFrame( *pLine );
-            OSL_ENSURE( pLineFrame, "Where is the Frame from the 
SwTableLine??" );
+            assert(pLineFrame && "Where is the Frame from the SwTableLine??");
 
             // Calculate the new relative size by means of the old one
             // If the selected Box get bigger, adjust via the max space else
diff --git a/sw/source/core/docnode/ndsect.cxx 
b/sw/source/core/docnode/ndsect.cxx
index 31f67cfc75f6..57413039bcff 100644
--- a/sw/source/core/docnode/ndsect.cxx
+++ b/sw/source/core/docnode/ndsect.cxx
@@ -1149,7 +1149,7 @@ void 
SwSectionNode::MakeFramesForAdjacentContentNode(const SwNodeIndex & rIdx)
 // the corresponding ContentFrame
 void SwSectionNode::MakeOwnFrames(SwNodeIndex* pIdxBehind, SwNodeIndex* 
pEndIdx)
 {
-    OSL_ENSURE( pIdxBehind, "no Index" );
+    assert(pIdxBehind && "no Index");
     SwNodes& rNds = GetNodes();
     SwDoc& rDoc = rNds.GetDoc();
 
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 509a3d18340c..7bc214fca871 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -2418,7 +2418,7 @@ void SwTableNode::MakeFramesForAdjacentContentNode(const 
SwNodeIndex & rIdx)
     SwFrame *pFrame;
     SwContentNode * pNode = rIdx.GetNode().GetContentNode();
 
-    OSL_ENSURE( pNode, "No ContentNode or CopyNode and new Node is identical");
+    assert(pNode && "No ContentNode or CopyNode and new Node is identical");
 
     bool bBefore = rIdx < GetIndex();
 
diff --git a/sw/source/core/docnode/ndtbl1.cxx 
b/sw/source/core/docnode/ndtbl1.cxx
index 0dd89a1541e9..c94d40fb8e5b 100644
--- a/sw/source/core/docnode/ndtbl1.cxx
+++ b/sw/source/core/docnode/ndtbl1.cxx
@@ -672,7 +672,7 @@ static void lcl_CollectCells( std::vector<SwCellFrame*> 
&rArr, const SwRect &rUn
         // in order to get to the Cell
         while ( !pCell->IsCellFrame() )
             pCell = pCell->GetUpper();
-        OSL_ENSURE( pCell, "Frame is not a Cell" );
+        assert(pCell && "Frame is not a Cell");
         if ( rUnion.Overlaps( pCell->getFrameArea() ) )
             ::InsertCell( rArr, static_cast<SwCellFrame*>(pCell) );
 
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index a762565ccfda..240fb569a89a 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -829,6 +829,7 @@ const SwTextNode* SwNode::FindOutlineNodeOfLevel(sal_uInt8 
const nLvl,
 
             Point aPt( 0, 0 );
             std::pair<Point, bool> const tmp(aPt, false);
+            assert(pRet);
             const SwFrame* pFrame = 
pRet->getLayoutFrame(pRet->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(),
 nullptr, &tmp),
                        * pMyFrame = pCNd ? 
pCNd->getLayoutFrame(pCNd->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(),
 nullptr, &tmp) : nullptr;
             const SwPageFrame* pPgFrame = pFrame ? pFrame->FindPageFrame() : 
nullptr;
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index 76f9362a1442..46f4a4aa8f46 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -2370,7 +2370,9 @@ void SwNodes::RemoveNode( SwNodeOffset nDelPos, 
SwNodeOffset nSz, bool bDel )
         }
 
         SwSectionNode* pSectionNode = pNode->GetSectionNode();
-        if (comphelper::LibreOfficeKit::isActive() && pSectionNode && 
!GetDoc().IsClipBoard() && SfxViewShell::Current())
+        SfxViewShell* pKitClipSh = (comphelper::LibreOfficeKit::isActive() && 
pSectionNode && !GetDoc().IsClipBoard())
+            ? SfxViewShell::Current() : nullptr;
+        if (pKitClipSh)
         {
             OUString fieldCommand = 
pSectionNode->GetSection().GetSectionName();
             tools::JsonWriter aJson;
@@ -2381,8 +2383,7 @@ void SwNodes::RemoveNode( SwNodeOffset nDelPos, 
SwNodeOffset nSz, bool bDel )
                 aJson.put("DeleteSection", fieldCommand);
             }
 
-            
SfxViewShell::Current()->libreOfficeKitViewCallback(LOK_CALLBACK_UNO_COMMAND_RESULT,
 aJson.finishAndGetAsOString());
-
+            
pKitClipSh->libreOfficeKitViewCallback(LOK_CALLBACK_UNO_COMMAND_RESULT, 
aJson.finishAndGetAsOString());
         }
     }
 
diff --git a/sw/source/core/docnode/section.cxx 
b/sw/source/core/docnode/section.cxx
index fce8e27ec3ce..9dcb637d2cea 100644
--- a/sw/source/core/docnode/section.cxx
+++ b/sw/source/core/docnode/section.cxx
@@ -836,9 +836,9 @@ static bool lcl_SectionCmpPos( const SwSection *pFirst, 
const SwSection *pSecond
 {
     const SwSectionFormat* pFSectFormat = pFirst->GetFormat();
     const SwSectionFormat* pSSectFormat = pSecond->GetFormat();
-    OSL_ENSURE( pFSectFormat && pSSectFormat &&
+    assert( pFSectFormat && pSSectFormat &&
             pFSectFormat->GetContent(false).GetContentIdx() &&
-            pSSectFormat->GetContent(false).GetContentIdx(),
+            pSSectFormat->GetContent(false).GetContentIdx() &&
                 "Invalid sections" );
     return pFSectFormat->GetContent(false).GetContentIdx()->GetIndex() <
                   pSSectFormat->GetContent(false).GetContentIdx()->GetIndex();
diff --git a/sw/source/core/draw/dview.cxx b/sw/source/core/draw/dview.cxx
index de84660ca94a..d98f90487cc2 100644
--- a/sw/source/core/draw/dview.cxx
+++ b/sw/source/core/draw/dview.cxx
@@ -332,8 +332,7 @@ sal_uInt32 SwDrawView::GetMaxChildOrdNum( const SwFlyFrame& 
_rParentObj,
     sal_uInt32 nMaxChildOrdNum = _rParentObj.GetDrawObj()->GetOrdNum();
 
     const SdrPage* pDrawPage = 
_rParentObj.GetDrawObj()->getSdrPageFromSdrObject();
-    OSL_ENSURE( pDrawPage,
-            "<SwDrawView::GetMaxChildOrdNum(..) - missing drawing page at 
parent object - crash!" );
+    assert(pDrawPage && "<SwDrawView::GetMaxChildOrdNum(..) - missing drawing 
page at parent object - crash!");
 
     const size_t nObjCount = pDrawPage->GetObjCount();
     for ( size_t i = nObjCount-1; i > _rParentObj.GetDrawObj()->GetOrdNum() ; 
--i )
diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx
index 6fafe1310d72..f11653df6ced 100644
--- a/sw/source/core/edit/autofmt.cxx
+++ b/sw/source/core/edit/autofmt.cxx
@@ -2316,6 +2316,7 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, 
SvxSwAutoFormatFlags aFlags,
     // set area for autoformatting
     if( pSttNd )
     {
+        assert(pEndNd);
         m_aNdIdx = *pSttNd;
         // for GoNextPara, one paragraph prior to that
         sw::GotoPrevLayoutTextFrame(m_aNdIdx, m_pEditShell->GetLayout());
@@ -2398,6 +2399,7 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, 
SvxSwAutoFormatFlags aFlags,
             break;
 
         case TST_EMPTY_LINE:
+            assert(m_pCurTextFrame);
             if (IsEmptyLine(*m_pCurTextFrame))
             {
                 if (m_aFlags.bDelEmptyNode && !HasObjects(*m_pCurTextFrame))
@@ -2419,6 +2421,7 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, 
SvxSwAutoFormatFlags aFlags,
             break;
 
         case TST_ALPHA_LINE:
+            assert(m_pCurTextFrame);
             if (IsNoAlphaLine(*m_pCurTextFrame))
             {
                 // recognize a table definition +---+---+
@@ -2457,6 +2460,7 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, 
SvxSwAutoFormatFlags aFlags,
 
         case GET_ALL_INFO:
             {
+                assert(m_pCurTextFrame);
                 if (m_pCurTextFrame->GetTextNodeForParaProps()->GetNumRule())
                 {
                     // do nothing in numbering, go to next
@@ -2567,6 +2571,8 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, 
SvxSwAutoFormatFlags aFlags,
                 if( !bReplaceStyles )
                     break;
 
+                assert(m_pCurTextFrame);
+
                 const OUString sClrStr( 
DelLeadingBlanks(m_pCurTextFrame->GetText()) );
 
                 if( sClrStr.isEmpty() )
@@ -2631,6 +2637,7 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, 
SvxSwAutoFormatFlags aFlags,
         case TST_ENUMERIC:
             {
                 bEmptyLine = false;
+                assert(m_pCurTextFrame);
                 if (IsEnumericChar(*m_pCurTextFrame))
                 {
                     if( nLevel >= MAXLEVEL )
diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx
index a65b83f52ad2..df06d04efc18 100644
--- a/sw/source/core/edit/editsh.cxx
+++ b/sw/source/core/edit/editsh.cxx
@@ -330,7 +330,7 @@ void SwEditShell::SetGraphicPolygon( const 
tools::PolyPolygon *pPoly )
 void SwEditShell::ClearAutomaticContour()
 {
     SwNoTextNode *pNd = GetCursor()->GetPointNode().GetNoTextNode();
-    OSL_ENSURE( pNd, "is no NoTextNode!" );
+    assert(pNd && "is no NoTextNode!");
     if( pNd->HasAutomaticContour() )
     {
         StartAllAction();
diff --git a/sw/source/core/edit/edsect.cxx b/sw/source/core/edit/edsect.cxx
index 070a37a90d2f..816008776e51 100644
--- a/sw/source/core/edit/edsect.cxx
+++ b/sw/source/core/edit/edsect.cxx
@@ -100,7 +100,7 @@ SwSection* SwEditShell::GetAnySection( bool bOutOfTab, 
const Point* pPt )
     if( pFrame && pFrame->IsInSct() )
     {
         SwSectionFrame* pSect = pFrame->FindSctFrame();
-        OSL_ENSURE( pSect, "GetAnySection: Where's my Sect?" );
+        assert(pSect && "GetAnySection: Where's my Sect?");
         if( pSect->IsInFootnote() && pSect->GetUpper()->IsInSct() )
         {
             pSect = pSect->GetUpper()->FindSctFrame();
diff --git a/sw/source/core/edit/edtox.cxx b/sw/source/core/edit/edtox.cxx
index 624e66bdde30..d11592adb4f0 100644
--- a/sw/source/core/edit/edtox.cxx
+++ b/sw/source/core/edit/edtox.cxx
@@ -129,7 +129,7 @@ void SwEditShell::InsertTableOf( const SwTOXBase& rTOX, 
const SfxItemSet* pSet )
     // Insert listing
     const SwTOXBaseSection* pTOX = mxDoc->InsertTableOf(
                 *GetCursor()->GetPoint(), rTOX, pSet, true, GetLayout() );
-    OSL_ENSURE(pTOX, "No current TOX");
+    assert(pTOX && "No current TOX");
 
     // start formatting
     CalcLayout();
diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx
index adf6097582b8..bbea9ab36cb0 100644
--- a/sw/source/core/fields/expfld.cxx
+++ b/sw/source/core/fields/expfld.cxx
@@ -172,7 +172,7 @@ const SwTextNode* GetBodyTextNode( const SwDoc& rDoc, 
SwPosition& rPos,
         {
             // get the FlyFormat
             const SwFrameFormat* pFlyFormat = static_cast<const 
SwFlyFrame*>(pLayout)->GetFormat();
-            OSL_ENSURE( pFlyFormat, "Could not find FlyFormat, where is the 
field?" );
+            assert(pFlyFormat && "Could not find FlyFormat, where is the 
field?");
 
             const SwFormatAnchor &rAnchor = pFlyFormat->GetAnchor();
 
diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx
index 0b50723abc92..82a27c4a36f5 100644
--- a/sw/source/core/frmedt/fecopy.cxx
+++ b/sw/source/core/frmedt/fecopy.cxx
@@ -1399,6 +1399,7 @@ void SwFEShell::Paste( SvStream& rStrm, SwPasteSdr 
nAction, const Point* pPt )
 
         SdrObject* pClpObj = pModel->GetPage(0)->GetObj(0);
         SdrObject* pOldObj = pView->GetMarkedObjectList().GetMark( 0 
)->GetMarkedSdrObj();
+        assert(pOldObj);
 
         if( SwPasteSdr::SetAttr == nAction && dynamic_cast<const 
SwVirtFlyDrawObj*>( pOldObj) !=  nullptr )
             nAction = SwPasteSdr::Replace;
@@ -1458,7 +1459,7 @@ void SwFEShell::Paste( SvStream& rStrm, SwPasteSdr 
nAction, const Point* pPt )
                         const SwTextFrame* pTmp = static_cast<const 
SwTextFrame*>(pAnchor);
                         do {
                             pTmp = pTmp->FindMaster();
-                            OSL_ENSURE( pTmp, "Where's my Master?" );
+                            assert(pTmp && "Where's my Master?");
                         } while( pTmp->IsFollow() );
                         pAnchor = pTmp;
                     }
@@ -1568,6 +1569,7 @@ void SwFEShell::Paste( SvStream& rStrm, SwPasteSdr 
nAction, const Point* pPt )
             if ( nCnt > 1 )
                 pView->GroupMarked();
             SdrObject *pObj = 
pView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
+            assert(pObj);
             if( dynamic_cast<const SdrUnoObj*>( pObj) !=  nullptr )
             {
                 pObj->SetLayer( 
GetDoc()->getIDocumentDrawModelAccess().GetControlsId() );
diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index eca71843557b..2716571c9945 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -497,6 +497,8 @@ Point SwFEShell::FindAnchorPos( const Point& rAbsPos, bool 
bMoveIt )
     if (!pContact)
         return aRet;
 
+    assert(pObj);
+
     // #i28701#
     SwAnchoredObject* pAnchoredObj = pContact->GetAnchoredObj( pObj );
     SwFrameFormat* pFormat = pAnchoredObj->GetFrameFormat();
diff --git a/uui/source/secmacrowarnings.cxx b/uui/source/secmacrowarnings.cxx
index 777ffbd8cf93..8868e93d5cd2 100644
--- a/uui/source/secmacrowarnings.cxx
+++ b/uui/source/secmacrowarnings.cxx
@@ -108,7 +108,7 @@ IMPL_LINK_NOARG(MacroWarning, EnableBtnHdl, weld::Button&, 
void)
             xD->addAuthorToTrustedSources( mxCert );
         else if( mxStore.is() )
         {
-            DBG_ASSERT( mpInfos, "-MacroWarning::EnableBtnHdl(): no infos, 
search in nirvana..." );
+            assert(mpInfos && "-MacroWarning::EnableBtnHdl(): no infos, search 
in nirvana...");
 
             sal_Int32   nCnt = mpInfos->getLength();
             for( sal_Int32 i = 0 ; i < nCnt ; ++i )
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index cb9378f471f8..d4767a4f3311 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -1036,7 +1036,7 @@ std::unique_ptr<weld::Notebook> 
JSInstanceBuilder::weld_notebook(const OUString&
     if (pNotebook && pNotebook->GetType() == WindowType::TABCONTROL)
         pWeldWidget
             = std::make_unique<JSNotebook>(this, 
static_cast<TabControl*>(pNotebook), this, false);
-    else if (pNotebook->GetType() == WindowType::VERTICALTABCONTROL)
+    else if (pNotebook && pNotebook->GetType() == 
WindowType::VERTICALTABCONTROL)
         pWeldWidget = std::make_unique<JSVerticalNotebook>(
             this, static_cast<VerticalTabControl*>(pNotebook), this, false);
 
diff --git a/vcl/source/bitmap/Vectorizer.cxx b/vcl/source/bitmap/Vectorizer.cxx
index d54046215122..1740a3eb3cad 100644
--- a/vcl/source/bitmap/Vectorizer.cxx
+++ b/vcl/source/bitmap/Vectorizer.cxx
@@ -221,6 +221,8 @@ ImplVectMap::ImplVectMap( tools::Long nWidth, tools::Long 
nHeight ) :
     mnWidth ( nWidth ),
     mnHeight( nHeight )
 {
+    assert(mpScan && "Don't handle OOM conditions");
+
     const tools::Long  nWidthAl = ( nWidth >> 2 ) + 1;
     Scanline    pTmp = mpBuf;
 
diff --git a/vcl/source/control/fmtfield.cxx b/vcl/source/control/fmtfield.cxx
index b8c561e206b3..5551280c7aca 100644
--- a/vcl/source/control/fmtfield.cxx
+++ b/vcl/source/control/fmtfield.cxx
@@ -457,6 +457,7 @@ void Formatter::ImplSetFormatKey(sal_uLong nFormatKey)
     if (bNeedFormatter)
     {
         GetOrCreateFormatter(); // this creates a standard formatter
+        assert(m_pFormatter);
 
         // It might happen that the standard formatter makes no sense here, 
but it takes a default
         // format. Thus, it is possible to set one of the other standard keys 
(which are spanning
diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx
index 6bf7eddc156d..697b4728369a 100644
--- a/vcl/source/edit/texteng.cxx
+++ b/vcl/source/edit/texteng.cxx
@@ -1325,7 +1325,7 @@ TextPaM TextEngine::SplitContent( sal_uInt32 nNode, 
sal_Int32 nSepPos )
 {
 #ifdef DBG_UTIL
     TextNode* pNode = mpDoc->GetNodes()[ nNode ].get();
-    SAL_WARN_IF( !pNode, "vcl", "SplitContent: Invalid Node!" );
+    assert(pNode && "SplitContent: Invalid Node!");
     SAL_WARN_IF( !IsInUndo(), "vcl", "SplitContent: only in Undo()!" );
     SAL_WARN_IF( nSepPos > pNode->GetText().getLength(), "vcl", "SplitContent: 
Bad index" );
 #endif
diff --git a/vcl/source/gdi/regionband.cxx b/vcl/source/gdi/regionband.cxx
index 9e543ed06c26..95802a0d6c63 100644
--- a/vcl/source/gdi/regionband.cxx
+++ b/vcl/source/gdi/regionband.cxx
@@ -334,7 +334,7 @@ bool RegionBand::isSingleRectangle() const
 
 void RegionBand::InsertBand(ImplRegionBand* pPreviousBand, ImplRegionBand* 
pBandToInsert)
 {
-    OSL_ASSERT(pBandToInsert!=nullptr);
+    assert(pBandToInsert);
 
     if(!pPreviousBand)
     {
diff --git a/vcl/source/helper/strhelper.cxx b/vcl/source/helper/strhelper.cxx
index 5364274798f6..bcc937a6b025 100644
--- a/vcl/source/helper/strhelper.cxx
+++ b/vcl/source/helper/strhelper.cxx
@@ -146,6 +146,7 @@ OUString GetCommandLineToken( int nToken, const OUString& 
rLine )
         nActualToken++;
     }
 
+    assert(pLeap && "otherwise would early return");
     *pLeap = 0;
 
     return OUString(pBuffer);
@@ -196,6 +197,7 @@ OString GetCommandLineToken(int nToken, const OString& 
rLine)
         nActualToken++;
     }
 
+    assert(pLeap && "otherwise would early return");
     *pLeap = 0;
 
     return pBuffer;
diff --git a/vcl/source/outdev/bitmapex.cxx b/vcl/source/outdev/bitmapex.cxx
index 8ca8f774997a..9ecccc90ed52 100644
--- a/vcl/source/outdev/bitmapex.cxx
+++ b/vcl/source/outdev/bitmapex.cxx
@@ -194,9 +194,7 @@ void OutputDevice::DrawDeviceBitmapEx( const Point& 
rDestPt, const Size& rDestSi
 
             if (xMaskBmp)
             {
-                bool bTryDirectPaint(pSalSrcBmp);
-
-                if (bTryDirectPaint && mpGraphics->DrawAlphaBitmap(aPosAry, 
*pSalSrcBmp, *xMaskBmp, *this))
+                if (mpGraphics->DrawAlphaBitmap(aPosAry, *pSalSrcBmp, 
*xMaskBmp, *this))
                 {
                     // tried to paint as alpha directly. If this worked, we 
are done (except
                     // alpha, see below)
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index 2ed9dc9a820e..1f342304ce5f 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -778,6 +778,7 @@ double OutputDevice::GetTextArray( const OUString& rStr, 
KernArray* pKernArray,
     // convert from font units to logical units
     if (pDXPixelArray)
     {
+        assert(pKernArray && "pDXPixelArray depends on pKernArray existing");
         int nSubPixelFactor = pKernArray->get_factor();
         if (mbMap)
         {
diff --git a/vcl/source/treelist/svimpbox.cxx b/vcl/source/treelist/svimpbox.cxx
index 66c697e8afd8..34dfd537a50b 100644
--- a/vcl/source/treelist/svimpbox.cxx
+++ b/vcl/source/treelist/svimpbox.cxx
@@ -180,7 +180,7 @@ short SvImpLBox::UpdateContextBmpWidthVector( 
SvTreeListEntry const * pEntry, sh
 
 void SvImpLBox::UpdateContextBmpWidthVectorFromMovedEntry( SvTreeListEntry* 
pEntry )
 {
-    DBG_ASSERT( pEntry, "Moved Entry is invalid!" );
+    assert(pEntry && "Moved Entry is invalid!");
 
     SvLBoxContextBmp* pBmpItem = static_cast< SvLBoxContextBmp* >( 
pEntry->GetFirstItem(SvLBoxItemType::ContextBmp) );
     short nExpWidth = 
static_cast<short>(pBmpItem->GetBitmap1().GetSizePixel().Width());
diff --git a/vcl/source/treelist/transfer.cxx b/vcl/source/treelist/transfer.cxx
index e99e470312e2..73ecd5f312ee 100644
--- a/vcl/source/treelist/transfer.cxx
+++ b/vcl/source/treelist/transfer.cxx
@@ -1015,9 +1015,8 @@ void TransferableHelper::CopyToPrimarySelection() const
 }
 
 void TransferableHelper::StartDrag( vcl::Window* pWindow, sal_Int8 
nDnDSourceActions )
-
 {
-    DBG_ASSERT( pWindow, "Window pointer is NULL" );
+    assert(pWindow && "Window pointer is NULL");
     Reference< XDragSource > xDragSource( pWindow->GetDragSource() );
 
     if( !xDragSource.is() )
diff --git a/vcl/source/treelist/treelist.cxx b/vcl/source/treelist/treelist.cxx
index 9d1aa62bd274..3c9079cb68cb 100644
--- a/vcl/source/treelist/treelist.cxx
+++ b/vcl/source/treelist/treelist.cxx
@@ -86,7 +86,7 @@ void SvTreeList::Broadcast(
 // an entry is visible if all parents are expanded
 bool SvTreeList::IsEntryVisible( const SvListView* pView, SvTreeListEntry* 
pEntry ) const
 {
-    DBG_ASSERT(pView&&pEntry,"IsVisible:Invalid Params");
+    assert(pView && pEntry && "IsVisible:Invalid Params");
     bool bRetVal = false;
     do
     {
@@ -176,7 +176,7 @@ sal_uInt32 findEntryPosition(const SvTreeListEntries& rDst, 
const SvTreeListEntr
 sal_uInt32 SvTreeList::Move(SvTreeListEntry* pSrcEntry,SvTreeListEntry* 
pTargetParent,sal_uInt32 nListPos)
 {
     // pDest may be 0!
-    DBG_ASSERT(pSrcEntry,"Entry?");
+    assert(pSrcEntry && "Entry?");
     if ( !pTargetParent )
         pTargetParent = pRootItem.get();
     DBG_ASSERT(pSrcEntry!=pTargetParent,"Move:Source=Target");
@@ -416,7 +416,7 @@ sal_uInt32 SvTreeList::GetChildCount( const 
SvTreeListEntry* pParent ) const
 
 sal_uInt32 SvTreeList::GetVisibleChildCount(const SvListView* pView, 
SvTreeListEntry* pParent) const
 {
-    DBG_ASSERT(pView,"GetVisChildCount:No View");
+    assert(pView && "GetVisChildCount:No View");
     if ( !pParent )
         pParent = pRootItem.get();
 
@@ -437,7 +437,7 @@ sal_uInt32 SvTreeList::GetVisibleChildCount(const 
SvListView* pView, SvTreeListE
 
 sal_uInt32 SvTreeList::GetChildSelectionCount(const SvListView* 
pView,SvTreeListEntry* pParent) const
 {
-    DBG_ASSERT(pView,"GetChildSelCount:No View");
+    assert(pView && "GetChildSelCount:No View");
     if ( !pParent )
         pParent = pRootItem.get();
 
@@ -525,7 +525,7 @@ SvTreeListEntry* SvTreeList::Next( SvTreeListEntry* 
pActEntry, sal_uInt16* pDept
 
 SvTreeListEntry* SvTreeList::Prev( SvTreeListEntry* pActEntry ) const
 {
-    DBG_ASSERT(pActEntry!=nullptr,"Entry?");
+    assert(pActEntry && "Entry?");
 
     SvTreeListEntries* pActualList = &pActEntry->pParent->m_Children;
     sal_uInt32 nActualPos = pActEntry->GetChildListPos();
@@ -566,7 +566,8 @@ SvTreeListEntry* SvTreeList::Last() const
 
 sal_uInt32 SvTreeList::GetVisiblePos( const SvListView* pView, SvTreeListEntry 
const * pEntry ) const
 {
-    DBG_ASSERT(pView&&pEntry,"View/Entry?");
+    assert(pView && "View?");
+    DBG_ASSERT(pEntry,"Entry?");
 
     if (!pView->m_pImpl->m_bVisPositionsValid)
     {
@@ -611,10 +612,11 @@ sal_uInt32 SvTreeList::GetVisibleCount( SvListView* pView 
) const
 // already visible.
 SvTreeListEntry* SvTreeList::NextVisible(const SvListView* 
pView,SvTreeListEntry* pActEntry,sal_uInt16* pActDepth) const
 {
-    DBG_ASSERT(pView,"NextVisible:No View");
     if ( !pActEntry )
         return nullptr;
 
+    assert(pView && "NextVisible:No View");
+
     sal_uInt16 nDepth = 0;
     bool bWithDepth = false;
     if ( pActDepth )
@@ -672,7 +674,7 @@ SvTreeListEntry* SvTreeList::NextVisible(const SvListView* 
pView,SvTreeListEntry
 
 SvTreeListEntry* SvTreeList::PrevVisible(const SvListView* pView, 
SvTreeListEntry* pActEntry) const
 {
-    DBG_ASSERT(pView&&pActEntry,"PrevVis:View/Entry?");
+    assert(pView && pActEntry && "PrevVis:View/Entry?");
 
     SvTreeListEntries* pActualList = &pActEntry->pParent->m_Children;
     sal_uInt32 nActualPos = pActEntry->GetChildListPos();
@@ -710,7 +712,8 @@ SvTreeListEntry* SvTreeList::LastVisible( const SvListView* 
pView) const
 
 SvTreeListEntry* SvTreeList::NextVisible(const SvListView* 
pView,SvTreeListEntry* pEntry,sal_uInt16& nDelta) const
 {
-    DBG_ASSERT(pView&&pEntry&&IsEntryVisible(pView,pEntry),"NextVis:Wrong 
Prms/!Vis");
+    assert(pView && pEntry && "NextVis:Wrong Prms!");
+    DBG_ASSERT(IsEntryVisible(pView,pEntry), "NextVis:Wrong Vis");
 
     sal_uInt32 nVisPos = GetVisiblePos( pView, pEntry );
     // nDelta entries existent?
@@ -777,7 +780,7 @@ SvTreeListEntry* SvTreeList::FirstChild( SvTreeListEntry* 
pParent ) const
 
 SvTreeListEntry* SvTreeList::NextSelected( const SvListView* pView, 
SvTreeListEntry* pEntry ) const
 {
-    DBG_ASSERT(pView&&pEntry,"NextSel:View/Entry?");
+    assert(pView && pEntry && "NextSel:View/Entry?");
     pEntry = Next( pEntry );
     while( pEntry && !pView->IsSelected(pEntry) )
         pEntry = Next( pEntry );
@@ -786,7 +789,7 @@ SvTreeListEntry* SvTreeList::NextSelected( const 
SvListView* pView, SvTreeListEn
 
 sal_uInt32 SvTreeList::Insert( SvTreeListEntry* pEntry,SvTreeListEntry* 
pParent,sal_uInt32 nPos )
 {
-    DBG_ASSERT( pEntry,"Entry?");
+    assert(pEntry && "Entry?");
 
     if ( !pParent )
         pParent = pRootItem.get();
@@ -845,7 +848,7 @@ void SvTreeList::SetAbsolutePositions()
 
 void SvListView::ExpandListEntry( SvTreeListEntry* pEntry )
 {
-    DBG_ASSERT(pEntry,"Expand:View/Entry?");
+    assert(pEntry && "Expand:View/Entry?");
     if ( IsExpanded(pEntry) )
         return;
 
@@ -864,7 +867,7 @@ void SvListView::ExpandListEntry( SvTreeListEntry* pEntry )
 
 void SvListView::CollapseListEntry( SvTreeListEntry* pEntry )
 {
-    DBG_ASSERT(pEntry,"Collapse:View/Entry?");
+    assert(pEntry && "Collapse:View/Entry?");
     if ( !IsExpanded(pEntry) )
         return;
 
@@ -910,7 +913,7 @@ bool SvListView::SelectListEntry( SvTreeListEntry* pEntry, 
bool bSelect )
 
 bool SvTreeList::Remove( const SvTreeListEntry* pEntry )
 {
-    DBG_ASSERT(pEntry,"Cannot remove root, use clear");
+    assert(pEntry && "Cannot remove root, use clear");
 
     if( !pEntry->pParent )
     {
@@ -1121,7 +1124,7 @@ void SvListView::ModelHasEntryInvalidated( 
SvTreeListEntry*)
 void SvListView::Impl::ActionMoving( SvTreeListEntry* pEntry )
 {
     SvTreeListEntry* pParent = pEntry->pParent;
-    DBG_ASSERT(pParent,"Model not consistent");
+    assert(pParent && "Model not consistent");
     if (pParent != m_rThis.pModel->pRootItem.get() && 
pParent->m_Children.size() == 1)
     {
         const auto iter = m_DataTable.find(pParent);
@@ -1393,7 +1396,7 @@ public:
 
 void SvTreeList::ResortChildren( SvTreeListEntry* pParent )
 {
-    DBG_ASSERT(pParent,"Parent not set");
+    assert(pParent && "Parent not set");
 
     if (pParent->m_Children.empty())
         return;
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index f2b0d381c7fa..225ad1b6f1c4 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -2750,6 +2750,8 @@ bool 
VclBuilder::sortIntoBestTabTraversalOrder::operator()(const vcl::Window *pA
 void VclBuilder::tweakInsertedChild(vcl::Window *pParent, vcl::Window* 
pCurrentChild,
                                     std::string_view sType, std::string_view 
sInternalChild)
 {
+    assert(pCurrentChild);
+
     //Internal-children default in glade to not having their visible bits set
     //even though they are visible (generally anyway)
     if (!sInternalChild.empty())
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index 207fdbf236f3..c76701b31698 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -1098,6 +1098,8 @@ void PrintDialog::checkOptionalControlDependencies()
 {
     for( const auto& rEntry : maControlToPropertyMap )
     {
+        assert(rEntry.first);
+
         bool bShouldbeEnabled = maPController->isUIOptionEnabled( 
rEntry.second );
 
         if (bShouldbeEnabled && dynamic_cast<weld::RadioButton*>(rEntry.first))
diff --git a/vcl/source/window/scrwnd.cxx b/vcl/source/window/scrwnd.cxx
index 9efc020a6aaa..511d60fc2ca5 100644
--- a/vcl/source/window/scrwnd.cxx
+++ b/vcl/source/window/scrwnd.cxx
@@ -50,7 +50,7 @@ ImplWheelWindow::ImplWheelWindow( vcl::Window* pParent ) :
             mnActDeltaY     ( 0 )
 {
     // we need a parent
-    SAL_WARN_IF( !pParent, "vcl", "ImplWheelWindow::ImplWheelWindow(): Parent 
not set!" );
+    assert(pParent && "ImplWheelWindow::ImplWheelWindow(): Parent not set!");
 
     const Size      aSize( pParent->GetOutputSizePixel() );
     const StartAutoScrollFlags nFlags = 
ImplGetSVData()->mpWinData->mnAutoScrollFlags;

Reply via email to