desktop/source/deployment/registry/component/dp_component.cxx | 2 +- drawinglayer/source/processor2d/vclpixelprocessor2d.cxx | 3 +-- drawinglayer/source/processor3d/zbufferprocessor3d.cxx | 2 +- editeng/source/editeng/editdbg.cxx | 2 +- editeng/source/editeng/editundo.cxx | 4 +++- editeng/source/editeng/eertfpar.cxx | 2 +- editeng/source/editeng/impedit3.cxx | 7 ++++--- editeng/source/editeng/impedit4.cxx | 8 +++++--- editeng/source/outliner/outliner.cxx | 7 ++++--- editeng/source/outliner/outlundo.cxx | 4 +--- editeng/source/outliner/outlvw.cxx | 2 +- editeng/source/uno/unoedprx.cxx | 8 ++++---- editeng/source/uno/unofored.cxx | 2 +- editeng/source/uno/unotext.cxx | 4 ++-- sfx2/source/appl/module.cxx | 4 +--- sfx2/source/appl/newhelp.cxx | 9 +++++---- sfx2/source/control/bindings.cxx | 2 +- sfx2/source/control/shell.cxx | 2 +- sfx2/source/dialog/mgetempl.cxx | 2 +- sfx2/source/dialog/templdlg.cxx | 4 ++-- sfx2/source/doc/docinsert.cxx | 2 +- sfx2/source/sidebar/SidebarDockingWindow.cxx | 2 +- 22 files changed, 43 insertions(+), 41 deletions(-)
New commits: commit ead19f4c62c8d74292a7ba589df2ca118cea3240 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Wed May 1 10:27:25 2024 +0100 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Wed May 1 13:25:04 2024 +0200 WaE: C6011 Dereferencing NULL pointer warnings Change-Id: Ic2231df89b900c17beac4627e3573b45aef0bc26 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166954 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/desktop/source/deployment/registry/component/dp_component.cxx b/desktop/source/deployment/registry/component/dp_component.cxx index 7efa1ba854e6..f374a88c04a9 100644 --- a/desktop/source/deployment/registry/component/dp_component.cxx +++ b/desktop/source/deployment/registry/component/dp_component.cxx @@ -1106,7 +1106,7 @@ void extractComponentData( componentLoader, OUString const & componentUrl) { - OSL_ASSERT( + assert( context.is() && registry.is() && data != nullptr && componentLoader.is()); OUString registryName(registry->getKeyName()); sal_Int32 prefix = registryName.getLength(); diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx index 754b8cef2592..4882847bcc2c 100644 --- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx @@ -586,8 +586,7 @@ void VclPixelProcessor2D::processUnifiedTransparencePrimitive2D( const primitive2d::PolyPolygonColorPrimitive2D* pPoPoColor = static_cast<const primitive2d::PolyPolygonColorPrimitive2D*>( pBasePrimitive); - SAL_WARN_IF(!pPoPoColor, "drawinglayer", - "OOps, PrimitiveID and PrimitiveType do not match (!)"); + assert(pPoPoColor && "OOps, PrimitiveID and PrimitiveType do not match (!)"); bDrawTransparentUsed = true; tryDrawPolyPolygonColorPrimitive2DDirect( *pPoPoColor, rUniTransparenceCandidate.getTransparence()); diff --git a/drawinglayer/source/processor3d/zbufferprocessor3d.cxx b/drawinglayer/source/processor3d/zbufferprocessor3d.cxx index b9cb8ffb7a1d..7f8f24f3b872 100644 --- a/drawinglayer/source/processor3d/zbufferprocessor3d.cxx +++ b/drawinglayer/source/processor3d/zbufferprocessor3d.cxx @@ -103,7 +103,7 @@ private: double decideColorAndOpacity(basegfx::BColor& rColor) const { // init values with full opacity and material color - OSL_ENSURE(nullptr != mpCurrentMaterial, "CurrentMaterial not set (!)"); + assert(nullptr != mpCurrentMaterial && "CurrentMaterial not set (!)"); double fOpacity(1.0); rColor = mpCurrentMaterial->getColor(); diff --git a/editeng/source/editeng/editdbg.cxx b/editeng/source/editeng/editdbg.cxx index f94bc2c7ea14..e9d74e779212 100644 --- a/editeng/source/editeng/editdbg.cxx +++ b/editeng/source/editeng/editdbg.cxx @@ -473,7 +473,7 @@ void EditEngine::DumpData(const EditEngine* pEE, bool bInfoBox) for ( size_t nView = 0; nView < pEE->GetViewCount(); nView++ ) { EditView* pV = pEE->GetView( nView ); - DBG_ASSERT( pV, "View not found!" ); + assert(pV && "View not found!"); fprintf( fp, " View %zu: Focus=%i", nView, pV->GetWindow()->HasFocus() ); tools::Rectangle aR( pV->GetOutputArea() ); fprintf( fp, " OutputArea: nX=%" SAL_PRIdINT64 ", nY=%" SAL_PRIdINT64 ", dX=%" SAL_PRIdINT64 ", dY=%" SAL_PRIdINT64 ", MapMode = %i", diff --git a/editeng/source/editeng/editundo.cxx b/editeng/source/editeng/editundo.cxx index 7ff299e7efbd..e6678e78f681 100644 --- a/editeng/source/editeng/editundo.cxx +++ b/editeng/source/editeng/editundo.cxx @@ -204,7 +204,9 @@ void EditUndoDelContent::Redo() ? pEE->GetEditDoc().GetObject(nNode) : pEE->GetEditDoc().GetObject(nNode - 1); - DBG_ASSERT(pCheckNode && pCheckNode != mpContentNode.get(), "?! RemoveContent !? "); + assert(pCheckNode); + + DBG_ASSERT(pCheckNode != mpContentNode.get(), "?! RemoveContent !? "); EditPaM aPaM(pCheckNode, pCheckNode->Len()); diff --git a/editeng/source/editeng/eertfpar.cxx b/editeng/source/editeng/eertfpar.cxx index 557081f8496f..024e10a5fad7 100644 --- a/editeng/source/editeng/eertfpar.cxx +++ b/editeng/source/editeng/eertfpar.cxx @@ -116,7 +116,7 @@ SvParserState EditRTFParser::CallParser() ContentNode* pCurNode = aCurSel.Max().GetNode(); sal_Int32 nPara = mpEditEngine->GetEditDoc().GetPos(pCurNode); ContentNode* pPrevNode = mpEditEngine->GetEditDoc().GetObject(nPara-1); - DBG_ASSERT( pPrevNode, "Invalid RTF-Document?!" ); + assert(pPrevNode && "Invalid RTF-Document?!"); EditSelection aSel; aSel.Min() = EditPaM( pPrevNode, pPrevNode->Len() ); aSel.Max() = EditPaM( pCurNode, 0 ); diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index b03f4d27afef..f548e2423490 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -4271,7 +4271,7 @@ void ImpEditEngine::InsertContent(std::unique_ptr<ContentNode> pNode, sal_Int32 EditPaM ImpEditEngine::SplitContent( sal_Int32 nNode, sal_Int32 nSepPos ) { ContentNode* pNode = maEditDoc.GetObject( nNode ); - DBG_ASSERT( pNode, "Invalid Node in SplitContent" ); + assert(pNode && "Invalid Node in SplitContent"); DBG_ASSERT( IsInUndo(), "SplitContent only for Undo()!" ); DBG_ASSERT( nSepPos <= pNode->Len(), "Index out of range: SplitContent" ); EditPaM aPaM( pNode, nSepPos ); diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index 121259f7e394..432bb29138ea 100644 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -147,8 +147,10 @@ EditPaM ImpEditEngine::ReadRTF( SvStream& rInput, EditSelection aSel ) pPool = pPool->GetSecondaryPool(); } - DBG_ASSERT(pPool && pPool->GetName() == "EditEngineItemPool", - "ReadRTF: no EditEnginePool!"); + assert(pPool && "ReadRTF: no EditEnginePool!"); + + DBG_ASSERT(pPool->GetName() == "EditEngineItemPool", + "ReadRTF: wrong EditEnginePool!"); EditRTFParserRef xPrsr = new EditRTFParser(rInput, aSel, *pPool, mpEditEngine); SvParserState eState = xPrsr->CallParser(); @@ -217,7 +219,7 @@ ErrCode ImpEditEngine::WriteText( SvStream& rOutput, EditSelection aSel ) for ( sal_Int32 nNode = nStartNode; nNode <= nEndNode; nNode++ ) { ContentNode* pNode = maEditDoc.GetObject( nNode ); - DBG_ASSERT( pNode, "Node not found: Search&Replace" ); + assert(pNode && "Node not found: Search&Replace"); sal_Int32 nStartPos = 0; sal_Int32 nEndPos = pNode->Len(); diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx index 671ecd017cfd..4a71d5b35b77 100644 --- a/editeng/source/outliner/outliner.cxx +++ b/editeng/source/outliner/outliner.cxx @@ -396,7 +396,7 @@ void Outliner::SetToEmptyText() void Outliner::SetText( const OUString& rText, Paragraph* pPara ) { - DBG_ASSERT(pPara,"SetText:No Para"); + assert(pPara && "SetText:No Para"); const sal_Int32 nPara = pParaList->GetAbsPos( pPara ); @@ -810,7 +810,8 @@ bool Outliner::Collapse( Paragraph const * pPara ) vcl::Font Outliner::ImpCalcBulletFont( sal_Int32 nPara ) const { const SvxNumberFormat* pFmt = GetNumberFormat( nPara ); - DBG_ASSERT( pFmt && ( pFmt->GetNumberingType() != SVX_NUM_BITMAP ) && ( pFmt->GetNumberingType() != SVX_NUM_NUMBER_NONE ), "ImpCalcBulletFont: Missing or BitmapBullet!" ); + assert(pFmt && "ImpCalcBulletFont: Missing!"); + DBG_ASSERT(( pFmt->GetNumberingType() != SVX_NUM_BITMAP ) && ( pFmt->GetNumberingType() != SVX_NUM_NUMBER_NONE ), "ImpCalcBulletFont: BitmapBullet!" ); vcl::Font aStdFont; if ( !pEditEngine->IsFlatMode() ) @@ -1380,7 +1381,7 @@ Size Outliner::ImplGetBulletSize( sal_Int32 nPara ) if( pPara->aBulSize.Width() == -1 ) { const SvxNumberFormat* pFmt = GetNumberFormat( nPara ); - DBG_ASSERT( pFmt, "ImplGetBulletSize - no Bullet!" ); + assert(pFmt && "ImplGetBulletSize - no Bullet!"); if ( pFmt->GetNumberingType() == SVX_NUM_NUMBER_NONE ) { diff --git a/editeng/source/outliner/outlundo.cxx b/editeng/source/outliner/outlundo.cxx index c2db1a77f353..799d33e29018 100644 --- a/editeng/source/outliner/outlundo.cxx +++ b/editeng/source/outliner/outlundo.cxx @@ -127,15 +127,13 @@ OLUndoExpand::OLUndoExpand(Outliner* pOut, sal_uInt16 _nId ) DBG_ASSERT(pOut,"Undo:No Outliner"); } - OLUndoExpand::~OLUndoExpand() { } - void OLUndoExpand::Restore( bool bUndo ) { - DBG_ASSERT(pOutliner,"Undo:No Outliner"); + assert(pOutliner && "Undo:No Outliner"); DBG_ASSERT(pOutliner->pEditEngine,"Outliner already deleted"); Paragraph* pPara; diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx index cd01503731eb..4bcd01905283 100644 --- a/editeng/source/outliner/outlvw.cxx +++ b/editeng/source/outliner/outlvw.cxx @@ -836,7 +836,7 @@ sal_Int32 OutlinerView::ImpCalcSelectedPages( bool bIncludeFirstSelected ) for ( sal_Int32 nPara = nStartPara; nPara <= aSel.nEndPara; nPara++ ) { Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara ); - DBG_ASSERT(pPara, "ImpCalcSelectedPages: invalid Selection? "); + assert(pPara && "ImpCalcSelectedPages: invalid Selection?"); if( pPara->HasFlag(ParaFlag::ISPAGE) ) { nPages++; diff --git a/editeng/source/uno/unoedprx.cxx b/editeng/source/uno/unoedprx.cxx index 20d5df281bce..1877d068e0e0 100644 --- a/editeng/source/uno/unoedprx.cxx +++ b/editeng/source/uno/unoedprx.cxx @@ -1128,21 +1128,21 @@ bool SvxAccessibleTextEditViewAdapter::IsValid() const Point SvxAccessibleTextEditViewAdapter::LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const { - DBG_ASSERT(mpViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder"); + assert(mpViewForwarder && "SvxAccessibleTextEditViewAdapter: no forwarder"); return mpViewForwarder->LogicToPixel(rPoint, rMapMode); } Point SvxAccessibleTextEditViewAdapter::PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const { - DBG_ASSERT(mpViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder"); + assert(mpViewForwarder && "SvxAccessibleTextEditViewAdapter: no forwarder"); return mpViewForwarder->PixelToLogic(rPoint, rMapMode); } bool SvxAccessibleTextEditViewAdapter::GetSelection( ESelection& rSel ) const { - DBG_ASSERT(mpViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder"); + assert(mpViewForwarder && "SvxAccessibleTextEditViewAdapter: no forwarder"); ESelection aSelection; @@ -1167,7 +1167,7 @@ bool SvxAccessibleTextEditViewAdapter::GetSelection( ESelection& rSel ) const bool SvxAccessibleTextEditViewAdapter::SetSelection( const ESelection& rSel ) { - DBG_ASSERT(mpViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder"); + assert(mpViewForwarder && "SvxAccessibleTextEditViewAdapter: no forwarder"); SvxAccessibleTextIndex aStartIndex; SvxAccessibleTextIndex aEndIndex; diff --git a/editeng/source/uno/unofored.cxx b/editeng/source/uno/unofored.cxx index fa2fa96118bf..6d088245f142 100644 --- a/editeng/source/uno/unofored.cxx +++ b/editeng/source/uno/unofored.cxx @@ -209,7 +209,7 @@ SfxItemState GetSvxEditEngineItemState( EditEngine const & rEditEngine, const ES for (auto const& attrib : aAttribs) { - DBG_ASSERT(attrib.pAttr, "GetCharAttribs gives corrupt data"); + assert(attrib.pAttr && "GetCharAttribs gives corrupt data"); const bool bEmptyPortion = attrib.nStart == attrib.nEnd; if((!bEmptyPortion && attrib.nStart >= nEndPos) || diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx index b5f329e62050..f4ad4096d875 100644 --- a/editeng/source/uno/unotext.cxx +++ b/editeng/source/uno/unotext.cxx @@ -216,7 +216,7 @@ SvxUnoTextRangeBase::SvxUnoTextRangeBase(const SvxEditSource* pSource, const Svx { SolarMutexGuard aGuard; - DBG_ASSERT(pSource,"SvxUnoTextRangeBase: I need a valid SvxEditSource!"); + assert(pSource && "SvxUnoTextRangeBase: I need a valid SvxEditSource!"); mpEditSource = pSource->Clone(); if (mpEditSource != nullptr) @@ -1435,7 +1435,7 @@ bool SvxUnoTextRangeBase::GoLeft(sal_Int32 nCount, bool Expand) noexcept { if ( !pForwarder ) pForwarder = mpEditSource->GetTextForwarder(); // first here, it is necessary... - + assert(pForwarder); --nNewPar; nCount -= nNewPos + 1; nNewPos = pForwarder->GetTextLen( nNewPar ); diff --git a/sfx2/source/appl/module.cxx b/sfx2/source/appl/module.cxx index b610c2ee8e2a..f82255446cf9 100644 --- a/sfx2/source/appl/module.cxx +++ b/sfx2/source/appl/module.cxx @@ -106,10 +106,9 @@ SfxSlotPool* SfxModule::GetSlotPool() const return &*pImpl->pSlotPool; } - void SfxModule::RegisterChildWindow(const SfxChildWinFactory& rFact) { - DBG_ASSERT( pImpl, "No real Module!" ); + assert(pImpl && "No real Module!"); for (size_t nFactory=0; nFactory<pImpl->maFactories.size(); ++nFactory) { @@ -124,7 +123,6 @@ void SfxModule::RegisterChildWindow(const SfxChildWinFactory& rFact) pImpl->maFactories.push_back( rFact ); } - void SfxModule::RegisterToolBoxControl( const SfxTbxCtrlFactory& rFact ) { #ifdef DBG_UTIL diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx index 925ed3a808ad..048cfd9538c4 100644 --- a/sfx2/source/appl/newhelp.cxx +++ b/sfx2/source/appl/newhelp.cxx @@ -1854,10 +1854,6 @@ IMPL_LINK( SfxHelpTextWindow_Impl, FindHdl, sfx2::SearchDialog&, rDlg, void ) } void SfxHelpTextWindow_Impl::FindHdl(sfx2::SearchDialog* pDlg) { - bool bWrapAround = ( nullptr == pDlg ); - if ( bWrapAround ) - pDlg = m_xSrchDlg.get(); - DBG_ASSERT( pDlg, "invalid search dialog" ); try { // select the words, which are equal to the search text of the search page @@ -1868,6 +1864,11 @@ void SfxHelpTextWindow_Impl::FindHdl(sfx2::SearchDialog* pDlg) Reference < XSearchable > xSearchable( xController->getModel(), UNO_QUERY ); if ( xSearchable.is() ) { + bool bWrapAround = ( nullptr == pDlg ); + if ( bWrapAround ) + pDlg = m_xSrchDlg.get(); + assert(pDlg && "invalid search dialog"); + // create descriptor, set string and find all words Reference < XSearchDescriptor > xSrchDesc = xSearchable->createSearchDescriptor(); xSrchDesc->setPropertyValue( "SearchWords", Any(pDlg->IsOnlyWholeWords()) ); diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx index a557fdb05233..f07287ee631c 100644 --- a/sfx2/source/control/bindings.cxx +++ b/sfx2/source/control/bindings.cxx @@ -1268,7 +1268,7 @@ bool SfxBindings::NextJob_Impl(Timer const * pTimer) while ( !bJobDone ) { SfxStateCache* pCache = pImpl->pCaches[pImpl->nMsgPos].get(); - DBG_ASSERT( pCache, "invalid SfxStateCache-position in job queue" ); + assert(pCache && "invalid SfxStateCache-position in job queue"); bool bWasDirty = pCache->IsControllerDirty(); if ( bWasDirty ) { diff --git a/sfx2/source/control/shell.cxx b/sfx2/source/control/shell.cxx index 3e3eb60506cc..3511d33ff69d 100644 --- a/sfx2/source/control/shell.cxx +++ b/sfx2/source/control/shell.cxx @@ -449,7 +449,7 @@ const SfxPoolItemHolder& SfxShell::ExecuteSlot pSlot = GetVerbSlot_Impl(nSlot); if ( !pSlot ) pSlot = pIF->GetSlot(nSlot); - DBG_ASSERT( pSlot, "slot not supported" ); + assert(pSlot && "slot not supported"); SfxExecFunc pFunc = pSlot->GetExecFnc(); if ( pFunc ) diff --git a/sfx2/source/dialog/mgetempl.cxx b/sfx2/source/dialog/mgetempl.cxx index ef97d253bd88..8de5f57f4404 100644 --- a/sfx2/source/dialog/mgetempl.cxx +++ b/sfx2/source/dialog/mgetempl.cxx @@ -435,7 +435,7 @@ bool SfxManageStyleSheetPage::FillItemSet( SfxItemSet* rSet ) m_xFilterLb->get_sensitive() ) { bModified = true; - OSL_ENSURE( pItem, "No Item" ); + assert(pItem && "No Item"); // is only possibly for user templates SfxStyleSearchBits nMask = pItem->GetFilterList()[m_xFilterLb->get_id(nFilterIdx).toUInt32()].nFlags | SfxStyleSearchBits::UserDefined; pStyle->SetMask( nMask ); diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx index 197e55b40bfb..02981e7f7672 100644 --- a/sfx2/source/dialog/templdlg.cxx +++ b/sfx2/source/dialog/templdlg.cxx @@ -670,8 +670,8 @@ void SfxCommonTemplateDialog_Impl::ActionSelect(const OUString& rEntry, StyleLis static OUString getModuleIdentifier( const Reference< XModuleManager2 >& i_xModMgr, SfxObjectShell const * i_pObjSh ) { - OSL_ENSURE( i_xModMgr.is(), "getModuleIdentifier(): no XModuleManager" ); - OSL_ENSURE( i_pObjSh, "getModuleIdentifier(): no ObjectShell" ); + assert(i_xModMgr.is() && "getModuleIdentifier(): no XModuleManager"); + assert(i_pObjSh && "getModuleIdentifier(): no ObjectShell"); OUString sIdentifier; diff --git a/sfx2/source/doc/docinsert.cxx b/sfx2/source/doc/docinsert.cxx index 52c55b103f31..29391841eef4 100644 --- a/sfx2/source/doc/docinsert.cxx +++ b/sfx2/source/doc/docinsert.cxx @@ -168,7 +168,7 @@ SfxMediumList DocumentInserter::CreateMediumList() static void impl_FillURLList( sfx2::FileDialogHelper const * _pFileDlg, std::vector<OUString>& _rpURLList ) { - DBG_ASSERT( _pFileDlg, "DocumentInserter::fillURLList(): invalid file dialog" ); + assert(_pFileDlg && "DocumentInserter::fillURLList(): invalid file dialog"); const Sequence < OUString > aPathSeq = _pFileDlg->GetSelectedFiles(); diff --git a/sfx2/source/sidebar/SidebarDockingWindow.cxx b/sfx2/source/sidebar/SidebarDockingWindow.cxx index d0edf8066332..f0939c8433bc 100644 --- a/sfx2/source/sidebar/SidebarDockingWindow.cxx +++ b/sfx2/source/sidebar/SidebarDockingWindow.cxx @@ -47,7 +47,7 @@ SidebarDockingWindow::SidebarDockingWindow(SfxBindings* pSfxBindings, SidebarChi // Get the XFrame from the bindings. if (pSfxBindings==nullptr || pSfxBindings->GetDispatcher()==nullptr) { - OSL_ASSERT(pSfxBindings!=nullptr); + assert(pSfxBindings != nullptr); OSL_ASSERT(pSfxBindings->GetDispatcher()!=nullptr); } else if (!comphelper::LibreOfficeKit::isActive()) commit 1d95bd8e5fcdcc241f4c945a4f01486df8e61f88 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Wed May 1 10:18:09 2024 +0100 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Wed May 1 13:24:55 2024 +0200 call SfxViewShell::Current() just once Change-Id: I8a4770d5018b3f3c4a4eb43763a211cfb636d7ac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166953 Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index c0a8b1fc734c..b03f4d27afef 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -4786,10 +4786,11 @@ Color ImpEditEngine::GetAutoColor() const { Color aColor; - if (comphelper::LibreOfficeKit::isActive() && SfxViewShell::Current()) + SfxViewShell* pKitSh = comphelper::LibreOfficeKit::isActive() ? SfxViewShell::Current() : nullptr; + if (pKitSh) { // Get document background color from current view instead - aColor = SfxViewShell::Current()->GetColorConfigColor(svtools::DOCCOLOR); + aColor = pKitSh->GetColorConfigColor(svtools::DOCCOLOR); if (aColor.IsDark()) aColor = COL_WHITE; else