extensions/source/bibliography/bibbeam.cxx                       |    2 -
 extensions/source/ole/oleobjw.cxx                                |    1 
 sw/source/core/edit/edundo.cxx                                   |    3 +-
 sw/source/core/fields/cellfml.cxx                                |   13 
++++++----
 sw/source/core/fields/fldlst.cxx                                 |    2 -
 sw/source/core/fields/reffld.cxx                                 |    4 +--
 sw/source/core/frmedt/fedesc.cxx                                 |    2 -
 sw/source/core/frmedt/fefly1.cxx                                 |    5 ++-
 sw/source/core/frmedt/feshview.cxx                               |    4 +--
 sw/source/core/frmedt/fetab.cxx                                  |    2 -
 sw/source/core/frmedt/fews.cxx                                   |    1 
 sw/source/core/layout/anchoredobject.cxx                         |    2 -
 sw/source/core/layout/findfrm.cxx                                |    2 -
 sw/source/core/layout/fly.cxx                                    |    2 -
 sw/source/core/layout/frmtool.cxx                                |    5 ++-
 sw/source/core/layout/ftnfrm.cxx                                 |    6 +++-
 sw/source/core/layout/hffrm.cxx                                  |    4 +--
 sw/source/core/layout/laycache.cxx                               |    4 ++-
 sw/source/core/layout/newfrm.cxx                                 |    2 -
 sw/source/core/layout/objectformattertxtfrm.cxx                  |    1 
 sw/source/core/layout/pagechg.cxx                                |    8 +++---
 sw/source/core/layout/paintfrm.cxx                               |    3 ++
 sw/source/core/layout/trvlfrm.cxx                                |    8 ++++--
 sw/source/core/layout/wsfrm.cxx                                  |    4 +--
 sw/source/core/objectpositioning/environmentofanchoredobject.cxx |    8 +++---
 sw/source/core/table/swnewtable.cxx                              |    8 +++---
 sw/source/core/table/swtable.cxx                                 |    4 +--
 sw/source/core/text/EnhancedPDFExportHelper.cxx                  |    2 -
 sw/source/core/text/frmcrsr.cxx                                  |    2 -
 sw/source/core/text/frmpaint.cxx                                 |    2 -
 sw/source/core/text/itrcrsr.cxx                                  |    2 -
 sw/source/core/text/porfld.cxx                                   |    2 -
 sw/source/core/text/porlay.cxx                                   |    2 +
 sw/source/core/text/txtftn.cxx                                   |    2 -
 xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx      |    2 -
 35 files changed, 76 insertions(+), 50 deletions(-)

New commits:
commit 3752d82833f3596208f30429ca9858b9ec22f2ca
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Fri May 3 21:45:34 2024 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Sat May 4 14:19:55 2024 +0200

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

diff --git a/extensions/source/bibliography/bibbeam.cxx 
b/extensions/source/bibliography/bibbeam.cxx
index a38c723852bc..1f83070f3c54 100644
--- a/extensions/source/bibliography/bibbeam.cxx
+++ b/extensions/source/bibliography/bibbeam.cxx
@@ -43,7 +43,7 @@ namespace bib
     {
         vcl::Window*             pParent = pWindow->GetParent();
 
-        DBG_ASSERT( pParent, "-GetTaskPaneList(): everybody here should have a 
parent!" );
+        assert(pParent && "-GetTaskPaneList(): everybody here should have a 
parent!");
 
         SystemWindow*       pSysWin = pParent->GetSystemWindow();
         if( pSysWin )
diff --git a/extensions/source/ole/oleobjw.cxx 
b/extensions/source/ole/oleobjw.cxx
index 160b094acb64..d9c0296110fd 100644
--- a/extensions/source/ole/oleobjw.cxx
+++ b/extensions/source/ole/oleobjw.cxx
@@ -695,6 +695,7 @@ Any SAL_CALL IUnknownWrapper::createBridge( const Any& 
modelDepObject,
         if (xInt == xSelf)
         {
             VARIANT* pVariant = 
static_cast<VARIANT*>(CoTaskMemAlloc(sizeof(VARIANT)));
+            assert(pVariant && "Don't handle OOM conditions");
 
             VariantInit(pVariant);
             if (m_bOriginalDispatch)
diff --git a/sw/source/core/edit/edundo.cxx b/sw/source/core/edit/edundo.cxx
index 576b092214df..1e7f93dfc141 100644
--- a/sw/source/core/edit/edundo.cxx
+++ b/sw/source/core/edit/edundo.cxx
@@ -231,12 +231,13 @@ static void lcl_SelectSdrMarkList( SwEditShell* pShell,
                             const SdrMarkList* pSdrMarkList )
 {
     OSL_ENSURE( pShell != nullptr, "need shell!" );
-    OSL_ENSURE( pSdrMarkList != nullptr, "need mark list" );
 
     SwFEShell* pFEShell = dynamic_cast<SwFEShell*>( pShell );
     if( !pFEShell )
         return;
 
+    assert(pSdrMarkList != nullptr && "need mark list");
+
     bool bFirst = true;
     for( size_t i = 0; i < pSdrMarkList->GetMarkCount(); ++i )
     {
diff --git a/sw/source/core/fields/cellfml.cxx 
b/sw/source/core/fields/cellfml.cxx
index 7a43f9a5e7cc..14558c8a35c4 100644
--- a/sw/source/core/fields/cellfml.cxx
+++ b/sw/source/core/fields/cellfml.cxx
@@ -429,7 +429,7 @@ void SwTableFormula::RelNmsToBoxNms( const SwTable& rTable, 
OUStringBuffer& rNew
 {
     // relative name w.r.t. box name (external presentation)
     SwNode* pNd = static_cast<SwNode*>(pPara);
-    OSL_ENSURE( pNd, "Field isn't in any TextNode" );
+    assert(pNd && "Field isn't in any TextNode");
     const SwTableBox *pBox = rTable.GetTableBox(
                     pNd->FindTableBoxStartNode()->GetIndex() );
 
@@ -462,7 +462,7 @@ void SwTableFormula::RelBoxNmsToPtr( const SwTable& rTable, 
OUStringBuffer& rNew
 {
     // relative name w.r.t. box name (internal presentation)
     SwNode* pNd = static_cast<SwNode*>(pPara);
-    OSL_ENSURE( pNd, "Field not placed in any Node" );
+    assert(pNd && "Field not placed in any Node");
     const SwTableBox *pBox = rTable.GetTableBox(
                     pNd->FindTableBoxStartNode()->GetIndex() );
 
@@ -494,7 +494,7 @@ void SwTableFormula::BoxNmsToRelNm( const SwTable& rTable, 
OUStringBuffer& rNewS
 {
     // box name (external presentation) w.r.t. relative name
     SwNode* pNd = static_cast<SwNode*>(pPara);
-    OSL_ENSURE( pNd, "Field not placed in any Node" );
+    assert(pNd && "Field not placed in any Node");
     const SwTableNode* pTableNd = pNd->FindTableNode();
 
     OUString sRefBoxNm;
@@ -502,7 +502,7 @@ void SwTableFormula::BoxNmsToRelNm( const SwTable& rTable, 
OUStringBuffer& rNewS
     {
         const SwTableBox *pBox = rTable.GetTableBox(
                 pNd->FindTableBoxStartNode()->GetIndex() );
-        OSL_ENSURE( pBox, "Field not placed in any Table" );
+        assert(pBox && "Field not placed in any Table");
         sRefBoxNm = pBox->GetName();
     }
 
@@ -597,6 +597,7 @@ void SwTableFormula::PtrToBoxNm( const SwTable* pTable )
     case EXTRNL_NAME:
         return;
     }
+    assert(pTable);
     m_sFormula = ScanString( fnFormula, *pTable, 
const_cast<void*>(static_cast<void const *>(pNd)) );
     m_eNmType = EXTRNL_NAME;
 }
@@ -622,6 +623,7 @@ void SwTableFormula::BoxNmToPtr( const SwTable* pTable )
     case INTRNL_NAME:
         return;
     }
+    assert(pTable);
     m_sFormula = ScanString( fnFormula, *pTable, 
const_cast<void*>(static_cast<void const *>(pNd)) );
     m_eNmType = INTRNL_NAME;
 }
@@ -644,6 +646,7 @@ void SwTableFormula::ToRelBoxNm( const SwTable* pTable )
     case REL_NAME:
         return;
     }
+    assert(pTable);
     m_sFormula = ScanString( fnFormula, *pTable, 
const_cast<void*>(static_cast<void const *>(pNd)) );
     m_eNmType = REL_NAME;
 }
@@ -773,7 +776,7 @@ static const SwFrame* lcl_GetBoxFrame( const SwTableBox& 
rBox )
 {
     SwNodeIndex aIdx( *rBox.GetSttNd() );
     SwContentNode* pCNd = SwNodes::GoNext(&aIdx);
-    OSL_ENSURE( pCNd, "Box has no TextNode" );
+    assert(pCNd && "Box has no TextNode");
     Point aPt;      // get the first frame of the layout - table headline
     std::pair<Point, bool> const tmp(aPt, false);
     return 
pCNd->getLayoutFrame(pCNd->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(),
 nullptr, &tmp);
diff --git a/sw/source/core/fields/fldlst.cxx b/sw/source/core/fields/fldlst.cxx
index 635d09d0ea30..976b4070a24f 100644
--- a/sw/source/core/fields/fldlst.cxx
+++ b/sw/source/core/fields/fldlst.cxx
@@ -78,7 +78,7 @@ size_t SwInputFieldList::Count() const
 SwField* SwInputFieldList::GetField(size_t nId)
 {
     const SwTextField* pTextField = (*mpSrtLst)[ nId ]->GetTextField();
-    OSL_ENSURE( pTextField, "no TextField" );
+    assert(pTextField && "no TextField");
     return const_cast<SwField*>(pTextField->GetFormatField().GetField());
 }
 
diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx
index 6c91573bec73..3d592f5c9403 100644
--- a/sw/source/core/fields/reffld.cxx
+++ b/sw/source/core/fields/reffld.cxx
@@ -1323,8 +1323,8 @@ SwTextNode* SwGetRefFieldType::FindAnchor(SwDoc* pDoc, 
const OUString& rRefMark,
                         // #i81002#
                         if(dynamic_cast< ::sw::mark::CrossRefBookmark const 
*>(pBkmk))
                         {
-                            OSL_ENSURE( pTextNd,
-                                    "<SwGetRefFieldType::FindAnchor(..)> - 
node marked by cross-reference bookmark isn't a text node --> crash" );
+                            assert(pTextNd &&
+                                    "<SwGetRefFieldType::FindAnchor(..)> - 
node marked by cross-reference bookmark isn't a text node --> crash");
                             *pEnd = pTextNd->Len();
                         }
                     }
diff --git a/sw/source/core/frmedt/fedesc.cxx b/sw/source/core/frmedt/fedesc.cxx
index 44720560ad00..c144201af6d2 100644
--- a/sw/source/core/frmedt/fedesc.cxx
+++ b/sw/source/core/frmedt/fedesc.cxx
@@ -86,7 +86,7 @@ void SwFEShell::ChgCurPageDesc( const SwPageDesc& rDesc )
         {
             pPage   = static_cast<SwPageFrame*>(pPage->GetNext());
             pFlow = pPage->FindFirstBodyContent();
-            OSL_ENSURE( pFlow, "Document without content?!?" );
+            assert(pFlow && "Document without content?!?");
         }
     }
 
diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index 2716571c9945..2b25d21424e3 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -403,7 +403,7 @@ const SwFrameFormat* SwFEShell::IsFlyInFly()
             pFly = static_cast<SwDrawContact*>(pContact)->GetAnchorFrame(pObj);
         }
 
-        OSL_ENSURE( pFly, "IsFlyInFly: Where's my anchor?" );
+        assert(pFly && "IsFlyInFly: Where's my anchor?");
         OSL_ENSURE( pFly->IsFlyFrame(), "IsFlyInFly: Funny anchor!" );
         return static_cast<const SwFlyFrame*>(pFly)->GetFormat();
     }
@@ -1910,6 +1910,7 @@ void SwFEShell::ReplaceSdrObj( const OUString& rGrfName, 
const Graphic* pGrf )
         return;
 
     SdrObject* pObj = pMrkList->GetMark( 0 )->GetMarkedSdrObj();
+    assert(pObj);
     SwFrameFormat *pFormat = FindFrameFormat( pObj );
 
     // store attributes, then set the graphic
@@ -1955,7 +1956,7 @@ void SwFEShell::ReplaceSdrObj( const OUString& rGrfName, 
const Graphic* pGrf )
 
 static sal_uInt16 SwFormatGetPageNum(const SwFlyFrameFormat * pFormat)
 {
-    OSL_ENSURE(pFormat != nullptr, "invalid argument");
+    assert(pFormat != nullptr && "invalid argument");
 
     SwFlyFrame * pFrame = pFormat->GetFrame();
 
diff --git a/sw/source/core/frmedt/feshview.cxx 
b/sw/source/core/frmedt/feshview.cxx
index 6a657fe96481..f15fb3e2f3e6 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -2104,7 +2104,7 @@ bool SwFEShell::ImpEndCreate()
             const SwTextFrame* pTmp = static_cast<const SwTextFrame*>(pAnch);
             do {
                 pTmp = pTmp->FindMaster();
-                OSL_ENSURE( pTmp, "Where's my Master?" );
+                assert(pTmp && "Where's my Master?");
             } while( pTmp->IsFollow() );
             pAnch = pTmp;
         }
@@ -2320,7 +2320,7 @@ Size SwFEShell::GetObjSize() const
 Point SwFEShell::GetAnchorObjDiff() const
 {
     const SdrView *pView = Imp()->GetDrawView();
-    OSL_ENSURE( pView, "GetAnchorObjDiff without DrawView?" );
+    assert(pView && "GetAnchorObjDiff without DrawView?");
 
     tools::Rectangle aRect;
     if ( Imp()->GetDrawView()->IsAction() )
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index 7997d12f22f4..e0606e085f5e 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -1748,7 +1748,7 @@ static const SwCellFrame *lcl_FindFrame( const 
SwLayoutFrame *pLay, const Point
                 if ( !bMouseMoveRowCols )
                 {
 
-                    OSL_ENSURE( pbCol && pbRow, "pbCol or pbRow missing" );
+                    assert(pbCol && pbRow && "pbCol or pbRow missing");
 
                     if ( bCloseToRow || bCloseToCol )
                     {
diff --git a/sw/source/core/frmedt/fews.cxx b/sw/source/core/frmedt/fews.cxx
index 539f48531353..b748ecbe1122 100644
--- a/sw/source/core/frmedt/fews.cxx
+++ b/sw/source/core/frmedt/fews.cxx
@@ -494,6 +494,7 @@ void SwFEShell::InsertLabel( const SwLabelType eType, const 
OUString &rText, con
             while ( !aDrawObjs.empty() )
             {
                 SdrObject* pDrawObj = aDrawObjs.back();
+                assert(pDrawObj);
                 if ( dynamic_cast<const SwVirtFlyDrawObj*>( pDrawObj) ==  
nullptr &&
                      dynamic_cast<const SwFlyDrawObj*>( pDrawObj) ==  nullptr )
                 {
diff --git a/sw/source/core/layout/anchoredobject.cxx 
b/sw/source/core/layout/anchoredobject.cxx
index cd950e3598c0..36d6caa37404 100644
--- a/sw/source/core/layout/anchoredobject.cxx
+++ b/sw/source/core/layout/anchoredobject.cxx
@@ -779,7 +779,7 @@ bool SwAnchoredObject::IsFormatPossible() const
 
 bool SwAnchoredObject::IsDraggingOffPageAllowed(const SwFrameFormat* 
pFrameFormat)
 {
-    OSL_ASSERT(pFrameFormat);
+    assert(pFrameFormat);
     const bool bDisablePositioning = 
pFrameFormat->getIDocumentSettingAccess().get(DocumentSettingId::DISABLE_OFF_PAGE_POSITIONING);
     const bool bIsWrapThrough = pFrameFormat->GetSurround().GetSurround() == 
text::WrapTextMode::WrapTextMode_THROUGH;
 
diff --git a/sw/source/core/layout/findfrm.cxx 
b/sw/source/core/layout/findfrm.cxx
index 7b85f267d26a..a86a7afefc87 100644
--- a/sw/source/core/layout/findfrm.cxx
+++ b/sw/source/core/layout/findfrm.cxx
@@ -555,7 +555,7 @@ SwFootnoteBossFrame* SwFrame::FindFootnoteBossFrame( bool 
bFootnotes )
         !pRet->GetNext() && !pRet->GetPrev() )
     {
         SwSectionFrame* pSct = pRet->FindSctFrame();
-        OSL_ENSURE( pSct, "FindFootnoteBossFrame: Single column outside 
section?" );
+        assert(pSct && "FindFootnoteBossFrame: Single column outside 
section?");
         if( !pSct->IsFootnoteAtEnd() )
             return pSct->FindFootnoteBossFrame( true );
     }
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 02b07a758b1a..549681ca7227 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -518,7 +518,7 @@ void SwFlyFrame::FinitDrawObj()
 
 void SwFlyFrame::ChainFrames( SwFlyFrame *pMaster, SwFlyFrame *pFollow )
 {
-    OSL_ENSURE( pMaster && pFollow, "incomplete chain" );
+    assert(pMaster && pFollow && "incomplete chain");
     OSL_ENSURE( !pMaster->GetNextLink(), "link can not be changed" );
     OSL_ENSURE( !pFollow->GetPrevLink(), "link can not be changed" );
 
diff --git a/sw/source/core/layout/frmtool.cxx 
b/sw/source/core/layout/frmtool.cxx
index 1d2377c36d79..282acf3e36ce 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -1591,6 +1591,7 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc,
     // ensure that the end of this range is positioned before EndIndex!
     for ( ; nEndIndex == SwNodeOffset(0) || nIndex < nEndIndex; ++nIndex)
     {
+        assert(pLayout);
         SwNode *pNd = pDoc->GetNodes()[nIndex];
         if ( pNd->IsContentNode() )
         {
@@ -2926,8 +2927,8 @@ SwFrame *SaveContent( SwLayoutFrame *pLay, SwFrame 
*pStart )
         } while ( pFloat );
 
         // search next chain part and connect both chains
-        SwFrame *pTmp = pFloat->FindNext();
-        if( bGo )
+        SwFrame *pTmp = pFloat ? pFloat->FindNext() : nullptr;
+        if (bGo && pFloat)
             pFloat->mpUpper = nullptr;
 
         if( !pLay->IsInFootnote() )
diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx
index e3b3adf819eb..0fd430ccc31d 100644
--- a/sw/source/core/layout/ftnfrm.cxx
+++ b/sw/source/core/layout/ftnfrm.cxx
@@ -2297,6 +2297,7 @@ void SwFootnoteBossFrame::RearrangeFootnotes( const 
SwTwips nDeadLine, const boo
             pCnt->InvalidateSize_();
             pCnt->Prepare( PrepareHint::AdjustSizeWithoutFormatting );
             SwFootnoteFrame* pFootnoteFrame = pCnt->FindFootnoteFrame();
+            assert(pFootnoteFrame);
             // #i49383#
             if ( pFootnoteFrame != pLastFootnoteFrame )
             {
@@ -2622,7 +2623,10 @@ SwTwips SwFootnoteBossFrame::GetVarSpace() const
                 nRet += nTmp;
         }
         else
+        {
+            assert(pPg);
             nRet -= aRectFnSet.GetHeight(pPg->getFramePrintArea())/5;
+        }
         if( nRet < 0 )
             nRet = 0;
     }
@@ -2665,7 +2669,7 @@ SwNeighbourAdjust 
SwFootnoteBossFrame::NeighbourhoodAdjustment_() const
             else
             {
                 const SwFrame* pTmp = Lower();
-                OSL_ENSURE( pTmp, "NeighbourhoodAdjustment: Missing Lower()" );
+                assert(pTmp && "NeighbourhoodAdjustment: Missing Lower()");
                 if( !pTmp->GetNext() )
                     nRet = SwNeighbourAdjust::GrowShrink;
                 else if( !GetUpper()->IsColLocked() )
diff --git a/sw/source/core/layout/hffrm.cxx b/sw/source/core/layout/hffrm.cxx
index 58ce1d8d4a2b..495564283670 100644
--- a/sw/source/core/layout/hffrm.cxx
+++ b/sw/source/core/layout/hffrm.cxx
@@ -414,7 +414,7 @@ void SwHeadFootFrame::FormatSize(SwTwips nUL, const 
SwBorderAttrs * pAttrs)
 
 void SwHeadFootFrame::Format(vcl::RenderContext* pRenderContext, const 
SwBorderAttrs * pAttrs)
 {
-    OSL_ENSURE( pAttrs, "SwFooterFrame::Format, pAttrs is 0." );
+    assert(pAttrs && "SwFooterFrame::Format, pAttrs is 0.");
 
     if ( isFramePrintAreaValid() && isFrameAreaSizeValid() )
         return;
@@ -652,7 +652,7 @@ SwTwips SwHeadFootFrame::ShrinkFrame( SwTwips nDist, bool 
bTst, bool bInfo )
 bool SwHeadFootFrame::GetEatSpacing() const
 {
     const SwFrameFormat * pFormat = GetFormat();
-    OSL_ENSURE(pFormat, "SwHeadFootFrame: no format?");
+    assert(pFormat && "SwHeadFootFrame: no format?");
 
     return pFormat->GetHeaderAndFooterEatSpacing().GetValue();
 }
diff --git a/sw/source/core/layout/laycache.cxx 
b/sw/source/core/layout/laycache.cxx
index 25cd970d9720..c2c03bb19f17 100644
--- a/sw/source/core/layout/laycache.cxx
+++ b/sw/source/core/layout/laycache.cxx
@@ -213,6 +213,7 @@ void SwLayoutCache::Write( SvStream &rStream, const SwDoc& 
rDoc )
                 else if( pTmp->IsTabFrame() )
                 {
                     SwTabFrame* pTab = static_cast<SwTabFrame*>(pTmp);
+                    assert(pTab);
                     sal_uLong nOfst = COMPLETE_STRING;
                     if( pTab->IsFollow() )
                     {
@@ -417,6 +418,7 @@ bool SwLayoutCache::CompareLayout( const SwDoc& rDoc ) const
                                     pSub = pSub->GetNext();
                                 }
                                 pTab = pTab->GetFollow();
+                                assert(pTab && "Table follow without master");
                                 const SwPageFrame *pTabPage = 
pTab->FindPageFrame();
                                 if( pTabPage != pPage )
                                 {
@@ -560,7 +562,7 @@ SwLayHelper::~SwLayHelper()
 {
     if( mpImpl )
     {
-        OSL_ENSURE( mpDoc && mpDoc->GetLayoutCache(), "Missing layoutcache" );
+        assert(mpDoc && mpDoc->GetLayoutCache() && "Missing layoutcache");
         mpDoc->GetLayoutCache()->UnlockImpl();
     }
 }
diff --git a/sw/source/core/layout/newfrm.cxx b/sw/source/core/layout/newfrm.cxx
index ef0701bf7e1e..786fbb5f2387 100644
--- a/sw/source/core/layout/newfrm.cxx
+++ b/sw/source/core/layout/newfrm.cxx
@@ -323,7 +323,7 @@ void FrameFinit()
 
 CurrShell::CurrShell( SwViewShell *pNew )
 {
-    OSL_ENSURE( pNew, "insert 0-Shell?" );
+    assert(pNew && "insert 0-Shell?");
     pRoot = pNew->GetLayout();
     if ( pRoot )
     {
diff --git a/sw/source/core/layout/objectformattertxtfrm.cxx 
b/sw/source/core/layout/objectformattertxtfrm.cxx
index 1b71301e7adb..5e3557a4ecd9 100644
--- a/sw/source/core/layout/objectformattertxtfrm.cxx
+++ b/sw/source/core/layout/objectformattertxtfrm.cxx
@@ -707,6 +707,7 @@ bool SwObjectFormatterTextFrame::CheckMovedFwdCondition(
                     && pObj->GetFrameFormat()->GetAnchor().GetAnchorId()
                         != RndStdIds::FLY_AS_CHAR)
                 {
+                    assert(pPageFrameOfAnchor);
                     if (pPageFrameOfAnchor->GetPhyPageNum() < 
pObjAnchorPage->GetPhyPageNum())
                     {
                         SAL_INFO("sw.layout", 
"SwObjectFormatterTextFrame::CheckMovedFwdCondition(): 
o_rbPageHasFlysAnchoredBelowThis because next page");
diff --git a/sw/source/core/layout/pagechg.cxx 
b/sw/source/core/layout/pagechg.cxx
index 2575c9827886..e60921c3cfa1 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -917,7 +917,7 @@ void SwPageFrame::Cut()
 void SwPageFrame::Paste( SwFrame* pParent, SwFrame* pSibling )
 {
     OSL_ENSURE( pParent->IsRootFrame(), "Parent is no Root." );
-    OSL_ENSURE( pParent, "No parent for Paste()." );
+    assert(pParent && "No parent for Paste().");
     OSL_ENSURE( pParent != this, "I'm my own parent." );
     OSL_ENSURE( pSibling != this, "I'm my own neighbour." );
     OSL_ENSURE( !GetPrev() && !GetNext() && !GetUpper(),
@@ -1536,7 +1536,7 @@ void SwRootFrame::RemoveSuperfluous()
                 while ( pPage->IsFootnotePage() )
                 {
                     pPage = static_cast<SwPageFrame*>(pPage->GetPrev());
-                    OSL_ENSURE( pPage, "only endnote pages remain." );
+                    assert(pPage && "only endnote pages remain.");
                 }
                 continue;
             }
@@ -1650,6 +1650,8 @@ void SwRootFrame::AssertFlyPages()
         pPage = static_cast<SwPageFrame*>(pPage->GetNext());
     }
 
+    assert(pPage);
+
     if ( nMaxPg > pPage->GetPhyPageNum() )
     {
         for ( sal_uInt16 i = pPage->GetPhyPageNum(); i < nMaxPg; ++i )
@@ -1688,7 +1690,7 @@ void SwRootFrame::AssertFlyPages()
 
 #if OSL_DEBUG_LEVEL > 0
     pPage = static_cast<SwPageFrame*>(Lower());
-    while ( pPage && pPage->GetNext() &&
+    while ( pPage->GetNext() &&
             !static_cast<SwPageFrame*>(pPage->GetNext())->IsFootnotePage() )
     {
         SAL_INFO( "sw.pageframe",  "AssertFlyPages p: " << pPage << " d: " << 
pPage->GetPageDesc()
diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index 1d27f9406c0c..8c0f4f876847 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -3740,6 +3740,7 @@ void SwLayoutFrame::PaintSwFrame(vcl::RenderContext& 
rRenderContext, SwRect cons
 
     while ( IsAnLower( pFrame ) )
     {
+        assert(pFrame);
         SwRect aPaintRect( pFrame->GetPaintArea() );
         if( aShortCut.Stop( aPaintRect ) )
             break;
@@ -4146,6 +4147,8 @@ bool SwFlyFrame::IsPaint( SdrObject *pObj, const 
SwViewShell *pSh )
     if ( nullptr == pUserCall )
         return true;
 
+    assert(pObj);
+
     //Attribute dependent, don't paint for printer or Preview
     bool bPaint =  gProp.pSFlyOnlyDraw ||
                        
static_cast<SwContact*>(pUserCall)->GetFormat()->GetPrint().GetValue();
diff --git a/sw/source/core/layout/trvlfrm.cxx 
b/sw/source/core/layout/trvlfrm.cxx
index f5978d15bd3b..fdbf55110ccd 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -991,7 +991,7 @@ bool SwContentFrame::UnitDown( SwPaM* pPam, const SwTwips, 
bool bInReadOnly ) co
  */
 sal_uInt16 SwRootFrame::GetCurrPage( const SwPaM *pActualCursor ) const
 {
-    OSL_ENSURE( pActualCursor, "got no page cursor" );
+    assert(pActualCursor && "got no page cursor");
     SwFrame const*const pActFrame = pActualCursor->GetPoint()->GetNode().
                                     GetContentNode()->getLayoutFrame(this,
                                                     pActualCursor->GetPoint());
@@ -1466,6 +1466,7 @@ void SwPageFrame::GetContentPosition( const Point &rPt, 
SwPosition &rPos ) const
     }
 
     //Bring the point into the PrtArea.
+    assert(pAct);
     const SwRect aRect( pAct->getFrameArea().Pos() + 
pAct->getFramePrintArea().Pos(), pAct->getFramePrintArea().SSize() );
     if ( aAct.Y() < aRect.Top() )
         aAct.setY( aRect.Top() );
@@ -1524,6 +1525,7 @@ Point SwRootFrame::GetNextPrevContentPos( const Point& 
rPoint, bool bNext ) cons
     {
         // As long as the point lies before the first ContentFrame and there 
are
         // still precedent pages I'll go to the next page.
+        assert(pPage);
         while ( rPoint.Y() < pCnt->getFrameArea().Top() && pPage->GetPrev() )
         {
             pPage = static_cast<const SwLayoutFrame*>(pPage->GetPrev());
@@ -1794,6 +1796,7 @@ bool SwFrame::WannaRightPage() const
     }
     if( !pPage->IsEmptyPage() )
     {
+        assert(pDesc && "No pagedescriptor");
         if( !pDesc->GetRightFormat() )
             isRightPage = false;
         else if( !pDesc->GetLeftFormat() )
@@ -1990,7 +1993,7 @@ bool SwRootFrame::MakeTableCursors( SwTableCursor& 
rTableCursor )
                                 while( !pCell->IsCellFrame() )
                                 {
                                     pCell = pCell->GetUpper();
-                                    OSL_ENSURE( pCell, "Where's my cell?" );
+                                    assert(pCell && "Where's my cell?");
                                 }
                             }
                         }
@@ -2513,6 +2516,7 @@ void SwRootFrame::CalcFrameRects(SwShellCursor const& 
rCursor, SwRects & rRects,
         bool const bBody = pStartFrame->IsInDocBody();
         const SwTableBox* pCellBox = pStartFrame->GetUpper()->IsCellFrame() ?
             static_cast<const 
SwCellFrame*>(pStartFrame->GetUpper())->GetTabBox() : nullptr;
+        assert(pSh);
         if (pSh->IsSelectAll())
             pCellBox = nullptr;
 
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index cab4f4e48ef8..e238893c3fe3 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -906,7 +906,6 @@ void SwFrame::InsertBefore( SwLayoutFrame* pParent, 
SwFrame* pBehind )
  */
 void SwFrame::InsertBehind( SwLayoutFrame *pParent, SwFrame *pBefore )
 {
-    OSL_ENSURE( pParent, "No Parent for Insert." );
     OSL_ENSURE( (!pBefore || pParent == pBefore->GetUpper()),
             "Frame tree is inconsistent." );
 
@@ -922,6 +921,7 @@ void SwFrame::InsertBehind( SwLayoutFrame *pParent, SwFrame 
*pBefore )
     }
     else
     {
+        assert(pParent && "No Parent for Insert.");
         //Insert at the beginning of the chain
         mpNext = pParent->Lower();
         if ( pParent->Lower() )
@@ -1350,7 +1350,7 @@ void SwContentFrame::Cut()
             }
             else
             {
-
+                assert(pSct);
                 if ( pSct->IsColLocked() || !pSct->IsInFootnote() ||
                      ( pUp->IsFootnoteFrame() && pUp->IsColLocked() ) )
                 {
diff --git a/sw/source/core/objectpositioning/environmentofanchoredobject.cxx 
b/sw/source/core/objectpositioning/environmentofanchoredobject.cxx
index e6529be386b9..1a29afa858ee 100644
--- a/sw/source/core/objectpositioning/environmentofanchoredobject.cxx
+++ b/sw/source/core/objectpositioning/environmentofanchoredobject.cxx
@@ -49,8 +49,8 @@ const SwLayoutFrame& 
SwEnvironmentOfAnchoredObject::GetHoriEnvironmentLayoutFram
                 !pHoriEnvironmentLayFrame->IsPageFrame() )
         {
             pHoriEnvironmentLayFrame = pHoriEnvironmentLayFrame->GetUpper();
-            OSL_ENSURE( pHoriEnvironmentLayFrame,
-                    
"SwEnvironmentOfAnchoredObject::GetHoriEnvironmentLayoutFrame(..) - no 
page|fly|cell frame found" );
+            assert(pHoriEnvironmentLayFrame &&
+                    
"SwEnvironmentOfAnchoredObject::GetHoriEnvironmentLayoutFrame(..) - no 
page|fly|cell frame found");
         }
     }
 
@@ -83,8 +83,8 @@ const SwLayoutFrame& 
SwEnvironmentOfAnchoredObject::GetVertEnvironmentLayoutFram
                 !pVertEnvironmentLayFrame->IsPageFrame() )
         {
             pVertEnvironmentLayFrame = pVertEnvironmentLayFrame->GetUpper();
-            OSL_ENSURE( pVertEnvironmentLayFrame,
-                    
"SwEnvironmentOfAnchoredObject::GetVertEnvironmentLayoutFrame(..) - proposed 
frame not found" );
+            assert(pVertEnvironmentLayFrame &&
+                    
"SwEnvironmentOfAnchoredObject::GetVertEnvironmentLayoutFrame(..) - proposed 
frame not found");
         }
     }
 
diff --git a/sw/source/core/table/swnewtable.cxx 
b/sw/source/core/table/swnewtable.cxx
index a8b7e0e0d233..ad240cab84e8 100644
--- a/sw/source/core/table/swnewtable.cxx
+++ b/sw/source/core/table/swnewtable.cxx
@@ -1783,7 +1783,7 @@ void SwTable::CreateSelection( const SwNode* pStartNd, 
const SwNode* pEndNd,
             for( size_t nCurrBox = 0; nCurrBox < nCount; ++nCurrBox )
             {
                 SwTableBox* pBox = pLine->GetTabBoxes()[nCurrBox];
-                OSL_ENSURE( pBox, "Missing table box" );
+                assert(pBox && "Missing table box");
                 if( pBox->getRowSpan() > 0 && ( !bChkProtected ||
                     !pBox->GetFrameFormat()->GetProtect().IsContentProtected() 
) )
                     rBoxes.insert( pBox );
@@ -2030,7 +2030,7 @@ SwSaveRowSpan::SwSaveRowSpan( SwTableBoxes& rBoxes, 
sal_uInt16 nSplitLn )
     for( size_t nCurrCol = 0; nCurrCol < nColCount; ++nCurrCol )
     {
         SwTableBox* pBox = rBoxes[nCurrCol];
-        OSL_ENSURE( pBox, "Missing Table Box" );
+        assert(pBox && "Missing Table Box");
         sal_Int32 nRowSp = pBox->getRowSpan();
         mnRowSpans[ nCurrCol ] = nRowSp;
         if( nRowSp < 0 )
@@ -2065,7 +2065,7 @@ void SwTable::RestoreRowSpan( const SwSaveRowSpan& rSave )
     for( size_t nCurrCol = 0; nCurrCol < nColCount; ++nCurrCol )
     {
         SwTableBox* pBox = pLine->GetTabBoxes()[nCurrCol];
-        OSL_ENSURE( pBox, "Missing Table Box" );
+        assert(pBox && "Missing Table Box");
         sal_Int32 nRowSp = pBox->getRowSpan();
         if( nRowSp != rSave.mnRowSpans[ nCurrCol ] )
         {
@@ -2121,7 +2121,7 @@ void SwTable::CleanUpBottomRowSpan( sal_uInt16 nDelLines )
     for( size_t nCurrCol = 0; nCurrCol < nColCount; ++nCurrCol )
     {
         SwTableBox* pBox = pLine->GetTabBoxes()[nCurrCol];
-        OSL_ENSURE( pBox, "Missing Table Box" );
+        assert(pBox && "Missing Table Box");
         sal_Int32 nRowSp = pBox->getRowSpan();
         if( nRowSp < 0 )
             nRowSp = -nRowSp;
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index 38314d25ecf6..3c1ad8d56094 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -138,7 +138,7 @@ void InsTableBox( SwDoc& rDoc, SwTableNode* pTableNd,
     SwContentNode* pCNd = aIdx.GetNode().GetContentNode();
     if( !pCNd )
         pCNd = SwNodes::GoNext(&aIdx);
-    OSL_ENSURE( pCNd, "Box with no content node" );
+    assert(pCNd && "Box with no content node");
 
     if( pCNd->IsTextNode() )
     {
@@ -2059,7 +2059,7 @@ SwTableBox::SwTableBox( SwTableBoxFormat* pFormat, const 
SwStartNode& rSttNd, Sw
 
     // insert into the table
     const SwTableNode* pTableNd = m_pStartNode->FindTableNode();
-    OSL_ENSURE( pTableNd, "In which table is the box?" );
+    assert(pTableNd && "In which table is the box?");
     SwTableSortBoxes& rSrtArr = 
const_cast<SwTableSortBoxes&>(pTableNd->GetTable().
                                 GetTabSortBoxes());
     SwTableBox* p = this;   // error: &this
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx 
b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index bbe216898f70..da596aab3b68 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -2633,7 +2633,7 @@ void 
SwEnhancedPDFExportHelper::EnhancedPDFExport(LanguageType const eLanguageDe
             {
                 // Check if outline is hidden
                 const SwTextNode* pTNd = mrSh.GetNodes().GetOutLineNds()[ i 
]->GetTextNode();
-                OSL_ENSURE( nullptr != pTNd, "Enhanced pdf export - text node 
is missing" );
+                assert(pTNd && "Enhanced pdf export - text node is missing");
 
                 if ( pTNd->IsHidden() ||
                      !sw::IsParaPropsNode(*mrSh.GetLayout(), *pTNd) ||
diff --git a/sw/source/core/text/frmcrsr.cxx b/sw/source/core/text/frmcrsr.cxx
index 94fcdf453cfa..2a643bb7c352 100644
--- a/sw/source/core/text/frmcrsr.cxx
+++ b/sw/source/core/text/frmcrsr.cxx
@@ -339,7 +339,7 @@ bool SwTextFrame::GetCharRect( SwRect& rOrig, const 
SwPosition &rPos,
     if( bRet )
     {
         SwPageFrame *pPage = pFrame->FindPageFrame();
-        OSL_ENSURE( pPage, "Text escaped from page?" );
+        assert(pPage && "Text escaped from page?");
         const SwTwips nOrigTop = aRectFnSet.GetTop(rOrig);
         const SwTwips nPageTop = aRectFnSet.GetTop(pPage->getFrameArea());
         const SwTwips nPageBott = aRectFnSet.GetBottom(pPage->getFrameArea());
diff --git a/sw/source/core/text/frmpaint.cxx b/sw/source/core/text/frmpaint.cxx
index d6d47f7ae637..8d20a4bf168b 100644
--- a/sw/source/core/text/frmpaint.cxx
+++ b/sw/source/core/text/frmpaint.cxx
@@ -135,7 +135,7 @@ SwExtraPainter::SwExtraPainter( const SwTextFrame *pFrame, 
SwViewShell *pVwSh,
         m_nDivider = !m_rLineInf.GetDivider().isEmpty() ? 
m_rLineInf.GetDividerCountBy() : 0;
         m_nX = pFrame->getFrameArea().Left();
         SwCharFormat* pFormat = m_rLineInf.GetCharFormat( 
const_cast<IDocumentStylePoolAccess&>(pFrame->GetDoc().getIDocumentStylePoolAccess())
 );
-        OSL_ENSURE( pFormat, "PaintExtraData without CharFormat" );
+        assert(pFormat && "PaintExtraData without CharFormat");
         m_pFnt.reset( new SwFont(&pFormat->GetAttrSet(), 
&pFrame->GetDoc().getIDocumentSettingAccess()) );
         m_pFnt->Invalidate();
         m_pFnt->ChgPhysFnt( m_pSh, *m_pSh->GetOut() );
diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx
index ea399a66f5d9..f083c9d56b5b 100644
--- a/sw/source/core/text/itrcrsr.cxx
+++ b/sw/source/core/text/itrcrsr.cxx
@@ -54,7 +54,7 @@ static void lcl_GetCharRectInsideField( SwTextSizeInfo& rInf, 
SwRect& rOrig,
                                  const SwCursorMoveState& rCMS,
                                  const SwLinePortion& rPor )
 {
-    OSL_ENSURE( rCMS.m_pSpecialPos, "Information about special pos missing" );
+    assert(rCMS.m_pSpecialPos && "Information about special pos missing");
 
     if ( rPor.InFieldGrp() && !static_cast<const 
SwFieldPortion&>(rPor).GetExp().isEmpty() )
     {
diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx
index d2ae4be00d1b..c1d5c80409dd 100644
--- a/sw/source/core/text/porfld.cxx
+++ b/sw/source/core/text/porfld.cxx
@@ -72,7 +72,7 @@ SwFieldPortion *SwFieldPortion::Clone( const OUString 
&rExpand ) const
 
 void SwFieldPortion::TakeNextOffset( const SwFieldPortion* pField )
 {
-    OSL_ENSURE( pField, "TakeNextOffset: Missing Source" );
+    assert(pField && "TakeNextOffset: Missing Source");
     m_nNextOffset = pField->GetNextOffset();
     m_aExpand = m_aExpand.replaceAt(0, sal_Int32(m_nNextOffset), u"");
     m_bFollow = true;
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index 50aaa43b7745..2e2d1e6e17a4 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -2565,6 +2565,8 @@ void SwScriptInfo::MarkKashidasInvalid(sal_Int32 const 
nCnt,
 
     while (nCntKash < CountKashida() && nKashidaPosIdx < nCnt)
     {
+        assert(pKashidaPositions && "Where are kashidas?");
+
         if ( pKashidaPositions [nKashidaPosIdx] > GetKashida( nCntKash ) )
         {
             ++nCntKash;
diff --git a/sw/source/core/text/txtftn.cxx b/sw/source/core/text/txtftn.cxx
index c1fa749c93f5..145a3a30d00f 100644
--- a/sw/source/core/text/txtftn.cxx
+++ b/sw/source/core/text/txtftn.cxx
@@ -240,7 +240,7 @@ static SwTwips lcl_GetFootnoteLower( const SwTextFrame* 
pFrame, SwTwips nLower )
     SwTwips nFlyLower = aRectFnSet.IsVert() ? LONG_MAX : 0;
     while ( pStartFrame != pFrame )
     {
-        OSL_ENSURE( pStartFrame, "Frame chain is broken" );
+        assert(pStartFrame && "Frame chain is broken");
         if ( pStartFrame->GetDrawObjs() )
         {
             const SwSortedObjs &rObjs = *pStartFrame->GetDrawObjs();
diff --git a/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx 
b/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx
index 918735d3800b..724cd5f24539 100644
--- a/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx
+++ b/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx
@@ -89,7 +89,7 @@ void XMLDocumentWrapper_XmlSecImpl::getNextSAXEvent()
  *  NODEPOSITION_NORMAL for other SAX events;
  
******************************************************************************/
 {
-    OSL_ASSERT( m_pCurrentElement != nullptr );
+    assert(m_pCurrentElement != nullptr);
 
         /*
          * Get the next event through tree order.

Reply via email to