summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2024-05-01 10:27:25 +0100
committerCaolán McNamara <caolan.mcnamara@collabora.com>2024-05-01 13:25:04 +0200
commitead19f4c62c8d74292a7ba589df2ca118cea3240 (patch)
tree69fa5d9bf938e7e1532b75183730c7800cf793ae /sfx2
parent1d95bd8e5fcdcc241f4c945a4f01486df8e61f88 (diff)
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.mcnamara@collabora.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/appl/module.cxx4
-rw-r--r--sfx2/source/appl/newhelp.cxx9
-rw-r--r--sfx2/source/control/bindings.cxx2
-rw-r--r--sfx2/source/control/shell.cxx2
-rw-r--r--sfx2/source/dialog/mgetempl.cxx2
-rw-r--r--sfx2/source/dialog/templdlg.cxx4
-rw-r--r--sfx2/source/doc/docinsert.cxx2
-rw-r--r--sfx2/source/sidebar/SidebarDockingWindow.cxx2
8 files changed, 13 insertions, 14 deletions
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())