dbaccess/source/core/api/column.cxx                     |    2 -
 dbaccess/source/core/misc/dsntypes.cxx                  |    2 -
 dbaccess/source/ui/browser/unodatbr.cxx                 |    6 ++--
 dbaccess/source/ui/dlg/DbAdminImpl.cxx                  |   20 ++++++++--------
 dbaccess/source/ui/dlg/sqlmessage.cxx                   |    2 -
 dbaccess/source/ui/querydesign/QTableConnectionData.cxx |    4 +--
 dbaccess/source/ui/querydesign/QTableWindow.cxx         |    2 -
 dbaccess/source/ui/querydesign/QueryDesignView.cxx      |    2 -
 dbaccess/source/ui/querydesign/QueryTableView.cxx       |    4 +--
 dbaccess/source/ui/querydesign/TableWindowTitle.cxx     |    2 -
 extensions/source/dbpilots/commonpagesdbp.cxx           |    2 -
 extensions/source/ole/unotypewrapper.cxx                |    2 -
 extensions/source/propctrlr/formcomponenthandler.cxx    |    2 -
 extensions/source/propctrlr/formmetadata.cxx            |    3 ++
 reportdesign/source/ui/inspection/metadata.cxx          |    3 ++
 reportdesign/source/ui/report/ReportSection.cxx         |    2 -
 reportdesign/source/ui/report/propbrw.cxx               |    1 
 17 files changed, 34 insertions(+), 27 deletions(-)

New commits:
commit a551290fc46d5f91b89615700c88b863a403bc7a
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Wed May 8 09:39:25 2024 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Wed May 8 15:11:42 2024 +0200

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

diff --git a/dbaccess/source/core/api/column.cxx 
b/dbaccess/source/core/api/column.cxx
index 58a8c1649cea..15378e22fd82 100644
--- a/dbaccess/source/core/api/column.cxx
+++ b/dbaccess/source/core/api/column.cxx
@@ -186,7 +186,7 @@ void OColumns::append( const OUString& _rName, OColumn* 
_pColumn )
 {
     MutexGuard aGuard(m_rMutex);
 
-    OSL_ENSURE( _pColumn, "OColumns::append: invalid column!" );
+    assert(_pColumn && "OColumns::append: invalid column!");
     OSL_ENSURE( !m_pElements->exists( _rName ),"OColumns::append: Column 
already exists");
 
     _pColumn->m_sName = _rName;
diff --git a/dbaccess/source/core/misc/dsntypes.cxx 
b/dbaccess/source/core/misc/dsntypes.cxx
index 2162c07240cb..0a25d603d4f1 100644
--- a/dbaccess/source/core/misc/dsntypes.cxx
+++ b/dbaccess/source/core/misc/dsntypes.cxx
@@ -509,7 +509,7 @@ ODsnTypeCollection::TypeIterator::TypeIterator(const 
ODsnTypeCollection* _pConta
     :m_pContainer(_pContainer)
     ,m_nPosition(_nInitialPos)
 {
-    OSL_ENSURE(m_pContainer, "ODsnTypeCollection::TypeIterator::TypeIterator : 
invalid container!");
+    assert(m_pContainer && "ODsnTypeCollection::TypeIterator::TypeIterator : 
invalid container!");
 #if OSL_DEBUG_LEVEL > 0
     ++const_cast<ODsnTypeCollection*>(m_pContainer)->m_nLivingIterators;
 #endif
diff --git a/dbaccess/source/ui/browser/unodatbr.cxx 
b/dbaccess/source/ui/browser/unodatbr.cxx
index bb226afc669f..e8c6f007719e 100644
--- a/dbaccess/source/ui/browser/unodatbr.cxx
+++ b/dbaccess/source/ui/browser/unodatbr.cxx
@@ -1055,7 +1055,7 @@ OUString 
SbaTableQueryBrowser::getDataSourceAccessor(const weld::TreeIter& rData
 {
     weld::TreeView& rTreeView = m_pTreeView->GetWidget();
     DBTreeListUserData* pData = 
weld::fromId<DBTreeListUserData*>(rTreeView.get_id(rDataSourceEntry));
-    OSL_ENSURE( pData, "SbaTableQueryBrowser::getDataSourceAccessor: invalid 
entry data!" );
+    assert(pData && "SbaTableQueryBrowser::getDataSourceAccessor: invalid 
entry data!");
     OSL_ENSURE( pData->eType == etDatasource, 
"SbaTableQueryBrowser::getDataSourceAccessor: entry does not denote a data 
source!" );
     return !pData->sAccessor.isEmpty() ? pData->sAccessor : 
GetEntryText(rDataSourceEntry);
 }
@@ -2253,7 +2253,7 @@ bool SbaTableQueryBrowser::ensureEntryObject(const 
weld::TreeIter& rEntry)
     // the user data of the entry
     weld::TreeView& rTreeView = m_pTreeView->GetWidget();
     DBTreeListUserData* pEntryData = 
weld::fromId<DBTreeListUserData*>(rTreeView.get_id(rEntry));
-    OSL_ENSURE(pEntryData,"ensureEntryObject: user data should already be 
set!");
+    assert(pEntryData && "ensureEntryObject: user data should already be 
set!");
 
     std::unique_ptr<weld::TreeIter> xDataSourceEntry = 
m_pTreeView->GetRootLevelParent(&rEntry);
 
@@ -2759,7 +2759,7 @@ void SAL_CALL SbaTableQueryBrowser::elementInserted(const 
ContainerEvent& rEvent
 
         // insert the new entry into the tree
         DBTreeListUserData* pContainerData = 
weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xEntry));
-        OSL_ENSURE(pContainerData, "elementInserted: There must be user data 
for this type!");
+        assert(pContainerData && "elementInserted: There must be user data for 
this type!");
 
         DBTreeListUserData* pNewData = new DBTreeListUserData;
         bool bIsTable = etTableContainer == pContainerData->eType;
diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.cxx 
b/dbaccess/source/ui/dlg/DbAdminImpl.cxx
index 90ca68f2d3d5..d1cbaa964c0a 100644
--- a/dbaccess/source/ui/dlg/DbAdminImpl.cxx
+++ b/dbaccess/source/ui/dlg/DbAdminImpl.cxx
@@ -431,9 +431,9 @@ Reference< XPropertySet > const & 
ODbDataSourceAdministrationHelper::getCurrentD
 OUString ODbDataSourceAdministrationHelper::getDatasourceType( const 
SfxItemSet& _rSet )
 {
     const SfxStringItem* pConnectURL = 
_rSet.GetItem<SfxStringItem>(DSID_CONNECTURL);
-    OSL_ENSURE( pConnectURL , 
"ODbDataSourceAdministrationHelper::getDatasourceType: invalid items in the 
source set!" );
+    assert(pConnectURL && 
"ODbDataSourceAdministrationHelper::getDatasourceType: invalid items in the 
source set!");
     const DbuTypeCollectionItem* pTypeCollection = 
_rSet.GetItem<DbuTypeCollectionItem>(DSID_TYPECOLLECTION);
-    OSL_ENSURE(pTypeCollection, 
"ODbDataSourceAdministrationHelper::getDatasourceType: invalid items in the 
source set!");
+    assert(pTypeCollection && 
"ODbDataSourceAdministrationHelper::getDatasourceType: invalid items in the 
source set!");
     ::dbaccess::ODsnTypeCollection* pCollection = 
pTypeCollection->getCollection();
     return pCollection->getType(pConnectURL->GetValue());
 }
@@ -452,10 +452,10 @@ OUString 
ODbDataSourceAdministrationHelper::getConnectionURL() const
     const SfxStringItem* pUrlItem = 
m_pItemSetHelper->getOutputSet()->GetItem<SfxStringItem>(DSID_CONNECTURL);
     const DbuTypeCollectionItem* pTypeCollection = 
m_pItemSetHelper->getOutputSet()->GetItem<DbuTypeCollectionItem>(DSID_TYPECOLLECTION);
 
-    OSL_ENSURE(pUrlItem,"Connection URL is NULL. -> GPF!");
-    OSL_ENSURE(pTypeCollection, 
"ODbDataSourceAdministrationHelper::getDatasourceType: invalid items in the 
source set!");
+    assert(pUrlItem && "Connection URL is NULL. -> GPF!");
+    assert(pTypeCollection && 
"ODbDataSourceAdministrationHelper::getDatasourceType: invalid items in the 
source set!");
     ::dbaccess::ODsnTypeCollection* pCollection = 
pTypeCollection->getCollection();
-    OSL_ENSURE(pCollection, 
"ODbDataSourceAdministrationHelper::getDatasourceType: invalid type 
collection!");
+    assert(pCollection && 
"ODbDataSourceAdministrationHelper::getDatasourceType: invalid type 
collection!");
 
     switch( pCollection->determineType(eType) )
     {
@@ -961,7 +961,7 @@ void 
ODbDataSourceAdministrationHelper::implTranslateProperty( SfxItemSet& _rSet
                 TypeDescription aTD(_rValue.getValueType());
                 typelib_IndirectTypeDescription* pSequenceTD =
                     reinterpret_cast< typelib_IndirectTypeDescription* 
>(aTD.get());
-                OSL_ENSURE(pSequenceTD && pSequenceTD->pType, 
"ODbDataSourceAdministrationHelper::implTranslateProperty: invalid sequence 
type!");
+                assert(pSequenceTD && pSequenceTD->pType && 
"ODbDataSourceAdministrationHelper::implTranslateProperty: invalid sequence 
type!");
 
                 Type aElementType(pSequenceTD->pType);
                 switch (aElementType.getTypeClass())
@@ -996,7 +996,7 @@ void 
ODbDataSourceAdministrationHelper::implTranslateProperty( SfxItemSet& _rSet
 OUString ODbDataSourceAdministrationHelper::getDocumentUrl(SfxItemSet const & 
_rDest)
 {
     const SfxStringItem* pUrlItem = 
_rDest.GetItem<SfxStringItem>(DSID_DOCUMENT_URL);
-    OSL_ENSURE(pUrlItem,"Document URL is NULL. -> GPF!");
+    assert(pUrlItem && "Document URL is NULL. -> GPF!");
     return pUrlItem->GetValue();
 }
 
@@ -1007,10 +1007,10 @@ void 
ODbDataSourceAdministrationHelper::convertUrl(SfxItemSet& _rDest)
     const SfxStringItem* pUrlItem = 
_rDest.GetItem<SfxStringItem>(DSID_CONNECTURL);
     const DbuTypeCollectionItem* pTypeCollection = 
_rDest.GetItem<DbuTypeCollectionItem>(DSID_TYPECOLLECTION);
 
-    OSL_ENSURE(pUrlItem,"Connection URL is NULL. -> GPF!");
-    OSL_ENSURE(pTypeCollection, "ODbAdminDialog::getDatasourceType: invalid 
items in the source set!");
+    assert(pUrlItem && "Connection URL is NULL. -> GPF!");
+    assert(pTypeCollection && "ODbAdminDialog::getDatasourceType: invalid 
items in the source set!");
     ::dbaccess::ODsnTypeCollection* pCollection = 
pTypeCollection->getCollection();
-    OSL_ENSURE(pCollection, "ODbAdminDialog::getDatasourceType: invalid type 
collection!");
+    assert(pCollection && "ODbAdminDialog::getDatasourceType: invalid type 
collection!");
 
     TypedWhichId<SfxInt32Item> nPortNumberId(0);
     sal_Int32 nPortNumber   = -1;
diff --git a/dbaccess/source/ui/dlg/sqlmessage.cxx 
b/dbaccess/source/ui/dlg/sqlmessage.cxx
index fe6eb7fd62de..07891f773cfd 100644
--- a/dbaccess/source/ui/dlg/sqlmessage.cxx
+++ b/dbaccess/source/ui/dlg/sqlmessage.cxx
@@ -207,7 +207,7 @@ namespace
             iter.next( aCurrentElement );
 
             const SQLException* pCurrentError = aCurrentElement;
-            OSL_ENSURE( pCurrentError, "lcl_buildExceptionChain: iterator 
failure!" );
+            assert(pCurrentError && "lcl_buildExceptionChain: iterator 
failure!");
                 // hasMoreElements should not have returned <TRUE/> in this 
case
 
             ExceptionDisplayInfo aDisplayInfo( aCurrentElement.getType() );
diff --git a/dbaccess/source/ui/querydesign/QTableConnectionData.cxx 
b/dbaccess/source/ui/querydesign/QTableConnectionData.cxx
index ce66828facb5..a42d65508008 100644
--- a/dbaccess/source/ui/querydesign/QTableConnectionData.cxx
+++ b/dbaccess/source/ui/querydesign/QTableConnectionData.cxx
@@ -87,8 +87,8 @@ void OQueryTableConnectionData::InitFromDrag(const 
OTableFieldDescRef& rDragLeft
     // convert Information in rDrag into parameters for the base class init
     OQueryTableWindow* pSourceWin = 
static_cast<OQueryTableWindow*>(rDragLeft->GetTabWindow());
     OQueryTableWindow* pDestWin = 
static_cast<OQueryTableWindow*>(rDragRight->GetTabWindow());
-    OSL_ENSURE(pSourceWin,"NO Source window found!");
-    OSL_ENSURE(pDestWin,"NO Dest window found!");
+    assert(pSourceWin && "NO Source window found!");
+    assert(pDestWin && "NO Dest window found!");
     m_pReferencingTable = pSourceWin->GetData();
     m_pReferencedTable  = pDestWin->GetData();
 
diff --git a/dbaccess/source/ui/querydesign/QTableWindow.cxx 
b/dbaccess/source/ui/querydesign/QTableWindow.cxx
index 93cbf6026d4c..ed490860c3ea 100644
--- a/dbaccess/source/ui/querydesign/QTableWindow.cxx
+++ b/dbaccess/source/ui/querydesign/QTableWindow.cxx
@@ -110,7 +110,7 @@ void 
OQueryTableWindow::OnEntryDoubleClicked(weld::TreeIter& rEntry)
 
     weld::TreeView& rTreeView = m_xListBox->get_widget();
     OTableFieldInfo* pInf = 
weld::fromId<OTableFieldInfo*>(rTreeView.get_id(rEntry));
-    OSL_ENSURE(pInf != nullptr, "OQueryTableWindow::OnEntryDoubleClicked : 
field doesn't have FieldInfo !");
+    assert(pInf && "OQueryTableWindow::OnEntryDoubleClicked : field doesn't 
have FieldInfo !");
 
     // build up DragInfo
     OTableFieldDescRef aInfo = new OTableFieldDesc(GetTableName(), 
rTreeView.get_text(rEntry));
diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx 
b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
index 108d36fd5729..47c7a996be94 100644
--- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
@@ -309,7 +309,7 @@ namespace
                     const OQueryTableWindow* _pEntryTabTo,
                     OUString& _rJoin )
     {
-        OSL_ENSURE(_pEntryConn,"TableConnection can not be null!");
+        assert(_pEntryConn && "TableConnection can not be null!");
 
         OQueryTableConnectionData* pData = static_cast< 
OQueryTableConnectionData*>(_pEntryConn->GetData().get());
         if ( !(pData->GetJoinType() != INNER_JOIN && 
_pEntryTabTo->ExistsAVisitedConn()) )
diff --git a/dbaccess/source/ui/querydesign/QueryTableView.cxx 
b/dbaccess/source/ui/querydesign/QueryTableView.cxx
index 663d3a9e65a6..f48dc17c7a3a 100644
--- a/dbaccess/source/ui/querydesign/QueryTableView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryTableView.cxx
@@ -496,7 +496,7 @@ void OQueryTableView::AddTabWin(const OUString& 
_rComposedName, const OUString&
                         if ( pTabWinTmp->GetData()->isQuery() )
                             continue;
 
-                        OSL_ENSURE(pTabWinTmp,"TableWindow is null!");
+                        assert(pTabWinTmp && "TableWindow is null!");
                         Reference< XPropertySet > xFKKey = getKeyReferencedTo( 
pTabWinTmp->GetData()->getKeys(), pNewTabWin->GetComposedName() );
                         if ( !xFKKey.is() )
                             continue;
@@ -751,7 +751,7 @@ void OQueryTableView::HideTabWin( OQueryTableWindow* 
pTabWin, OQueryTabWinUndoAc
     {
         VclPtr<OTableConnection> xTmpEntry = *aIter2;
         OQueryTableConnection* pTmpEntry = 
static_cast<OQueryTableConnection*>(xTmpEntry.get());
-        OSL_ENSURE(pTmpEntry,"OQueryTableConnection is null!");
+        assert(pTmpEntry && "OQueryTableConnection is null!");
         if( pTmpEntry->GetAliasName(JTCS_FROM) == pTabWin->GetAliasName() ||
             pTmpEntry->GetAliasName(JTCS_TO) == pTabWin->GetAliasName() )
         {
diff --git a/dbaccess/source/ui/querydesign/TableWindowTitle.cxx 
b/dbaccess/source/ui/querydesign/TableWindowTitle.cxx
index 0e3ad0573c7f..2990a010298b 100644
--- a/dbaccess/source/ui/querydesign/TableWindowTitle.cxx
+++ b/dbaccess/source/ui/querydesign/TableWindowTitle.cxx
@@ -64,7 +64,7 @@ IMPL_LINK(OTableWindowTitle, MousePressHdl, const 
MouseEvent&, rEvt, bool)
                 m_pTabWin->SetSizePixel(aSize);
 
                 OJoinTableView* pView = m_pTabWin->getTableView();
-                OSL_ENSURE(pView,"No OJoinTableView!");
+                assert(pView && "No OJoinTableView!");
                 for (auto& conn : pView->getTableConnections())
                     conn->RecalcLines();
 
diff --git a/extensions/source/dbpilots/commonpagesdbp.cxx 
b/extensions/source/dbpilots/commonpagesdbp.cxx
index dfeac375c391..9aea1855f199 100644
--- a/extensions/source/dbpilots/commonpagesdbp.cxx
+++ b/extensions/source/dbpilots/commonpagesdbp.cxx
@@ -397,7 +397,7 @@ namespace dbp
     {
         OControlWizardPage::Activate();
 
-        DBG_ASSERT(m_pYes, "OMaybeListSelectionPage::Activate: no controls 
announced!");
+        assert(m_pYes && "OMaybeListSelectionPage::Activate: no controls 
announced!");
         if (m_pYes->get_active())
             m_pList->grab_focus();
         else
diff --git a/extensions/source/ole/unotypewrapper.cxx 
b/extensions/source/ole/unotypewrapper.cxx
index 2824e8ef7b27..6ec58096e919 100644
--- a/extensions/source/ole/unotypewrapper.cxx
+++ b/extensions/source/ole/unotypewrapper.cxx
@@ -25,7 +25,7 @@
 bool createUnoTypeWrapper(BSTR sTypeName, VARIANT * pVar)
 {
     bool ret = false;
-    OSL_ASSERT(sTypeName && pVar);
+    assert(sTypeName && pVar);
     CComObject< UnoTypeWrapper>* pObj;
     VariantClear(pVar);
     if( SUCCEEDED( CComObject<UnoTypeWrapper>::CreateInstance( &pObj)))
diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx 
b/extensions/source/propctrlr/formcomponenthandler.cxx
index b00cc9a110c3..9933ce2f9dce 100644
--- a/extensions/source/propctrlr/formcomponenthandler.cxx
+++ b/extensions/source/propctrlr/formcomponenthandler.cxx
@@ -2687,7 +2687,7 @@ namespace pcr
             Reference< XUnoTunnel > xTunnel( xSupplier, UNO_QUERY_THROW );
             SvNumberFormatsSupplierObj* pSupplier =
                 reinterpret_cast< SvNumberFormatsSupplierObj* >( 
xTunnel->getSomething( SvNumberFormatsSupplierObj::getUnoTunnelId() ) );
-            DBG_ASSERT( pSupplier != nullptr, 
"FormComponentPropertyHandler::impl_dialogFormatting_nothrow: invalid call !" );
+            assert(pSupplier && 
"FormComponentPropertyHandler::impl_dialogFormatting_nothrow: invalid call !");
 
             sal_Int32 nFormatKey = 0;
             impl_getPropertyValue_throw( PROPERTY_FORMATKEY ) >>= nFormatKey;
diff --git a/extensions/source/propctrlr/formmetadata.cxx 
b/extensions/source/propctrlr/formmetadata.cxx
index 8a3674e1690a..025b03886220 100644
--- a/extensions/source/propctrlr/formmetadata.cxx
+++ b/extensions/source/propctrlr/formmetadata.cxx
@@ -588,7 +588,10 @@ namespace pcr
     {
         // Initialization
         if(!s_pPropertyInfos)
+        {
             getPropertyInfo();
+            assert(s_pPropertyInfos);
+        }
 
         // TODO: a real structure which allows quick access by name as well as 
by id
         for (std::size_t i = 0; i < s_nCount; ++i)
diff --git a/reportdesign/source/ui/inspection/metadata.cxx 
b/reportdesign/source/ui/inspection/metadata.cxx
index 954e7ee2141b..e18820647fae 100644
--- a/reportdesign/source/ui/inspection/metadata.cxx
+++ b/reportdesign/source/ui/inspection/metadata.cxx
@@ -192,7 +192,10 @@ namespace rptui
     {
         // initialization
         if(!s_pPropertyInfos)
+        {
             getPropertyInfo();
+            assert(s_pPropertyInfos);
+        }
 
         // TODO: a real structure which allows quick access by name as well as 
by id
         for (sal_uInt16 i = 0; i < s_nCount; i++)
diff --git a/reportdesign/source/ui/report/ReportSection.cxx 
b/reportdesign/source/ui/report/ReportSection.cxx
index f910c3dbdf99..646ab278629a 100644
--- a/reportdesign/source/ui/report/ReportSection.cxx
+++ b/reportdesign/source/ui/report/ReportSection.cxx
@@ -148,7 +148,7 @@ void OReportSection::Paint( vcl::RenderContext& 
rRenderContext, const tools::Rec
     if (pPgView)
     {
         pTargetPaintWindow = pPgView->GetView().BeginDrawLayers(GetOutDev(), 
aPaintRectRegion);
-        OSL_ENSURE(pTargetPaintWindow, "BeginDrawLayers: Got no SdrPaintWindow 
(!)");
+        assert(pTargetPaintWindow && "BeginDrawLayers: Got no SdrPaintWindow 
(!)");
         // draw background self using wallpaper
         OutputDevice& rTargetOutDev = 
pTargetPaintWindow->GetTargetOutputDevice();
         rTargetOutDev.DrawWallpaper(rRect, 
Wallpaper(pPgView->GetApplicationDocumentColor()));
diff --git a/reportdesign/source/ui/report/propbrw.cxx 
b/reportdesign/source/ui/report/propbrw.cxx
index 60e45e1fefc2..df04f39309e3 100644
--- a/reportdesign/source/ui/report/propbrw.cxx
+++ b/reportdesign/source/ui/report/propbrw.cxx
@@ -273,6 +273,7 @@ uno::Sequence< Reference<uno::XInterface> > 
PropBrw::CreateCompPropSet(const Sdr
     for(size_t i=0; i<nMarkCount; ++i)
     {
         SdrObject* pCurrent = _rMarkList.GetMark(i)->GetMarkedSdrObj();
+        assert(pCurrent);
 
         ::std::optional<SdrObjListIter> oGroupIterator;
         if (pCurrent->IsGroupObject())

Reply via email to