diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-05-02 17:57:22 +0100 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-05-03 09:17:09 +0200 |
commit | 8662a96c90b56f61bf24380094f217e7170f54be (patch) | |
tree | 8f7655d59e15cc2f7a8f98819408dd50698f7bc9 /sw/source | |
parent | 3cc6384e41819eb8a5182a9ab7fd8f74d3cea9e5 (diff) |
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.mcnamara@collabora.com>
Diffstat (limited to 'sw/source')
30 files changed, 60 insertions, 36 deletions
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(); |