sc/inc/global.hxx                                 |    2 -
 sc/qa/unit/copy_paste_test.cxx                    |   12 +++++-----
 sc/source/core/data/global.cxx                    |    4 +--
 sc/source/core/data/table3.cxx                    |    6 ++---
 sc/source/core/data/table4.cxx                    |    4 +--
 sc/source/core/tool/appoptio.cxx                  |   19 ++++++----------
 sc/source/filter/excel/excrecds.cxx               |    6 ++---
 sc/source/filter/oox/autofilterbuffer.cxx         |   10 ++++----
 sc/source/ui/app/scmod.cxx                        |    9 ++-----
 sc/source/ui/dbgui/tpsort.cxx                     |   11 +++------
 sc/source/ui/dbgui/tpsubt.cxx                     |   11 +++------
 sc/source/ui/unoobj/appluno.cxx                   |   25 +++++++++-------------
 sc/source/ui/view/dbfunc3.cxx                     |   13 +++--------
 sc/source/ui/view/gridwin2.cxx                    |   15 +++++--------
 winaccessibility/source/UAccCOM/AccActionBase.cxx |    3 +-
 winaccessibility/source/UAccCOM/AccTable.cxx      |    2 +
 winaccessibility/source/UAccCOM/AccTableCell.cxx  |    2 +
 17 files changed, 67 insertions(+), 87 deletions(-)

New commits:
commit ef2066cdfe86019a3099b3530fb091ca2a4d2446
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Sun May 5 20:50:54 2024 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Mon May 6 12:23:29 2024 +0200

    ScGlobal::GetUserList never returns null
    
    Change-Id: Ibce3fc1b6d85fc6183fc2552a71ead6443b45fad
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167172
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx
index 5cb782ac14dc..1b512b6a7987 100644
--- a/sc/inc/global.hxx
+++ b/sc/inc/global.hxx
@@ -571,7 +571,7 @@ public:
     static void                 ClearAutoFormat(); //BugId 54209
     static LegacyFuncCollection*      GetLegacyFuncCollection();
     SC_DLLPUBLIC static ScUnoAddInCollection* GetAddInCollection();
-    SC_DLLPUBLIC static ScUserList*         GetUserList();
+    SC_DLLPUBLIC static ScUserList&         GetUserList();
     static void                 SetUserList( const ScUserList* pNewList );
     /**
      * Open the specified URL.
diff --git a/sc/qa/unit/copy_paste_test.cxx b/sc/qa/unit/copy_paste_test.cxx
index 35ed48b6e02e..c64e194de54e 100644
--- a/sc/qa/unit/copy_paste_test.cxx
+++ b/sc/qa/unit/copy_paste_test.cxx
@@ -609,7 +609,7 @@ void ScCopyPasteTest::tdf137205_autofillDatesInMergedCells()
 
 void ScCopyPasteTest::addToUserList(const OUString& rStr)
 {
-    ScGlobal::GetUserList()->emplace_back(rStr);
+    ScGlobal::GetUserList().emplace_back(rStr);
 }
 
 void ScCopyPasteTest::tdf137653_137654_autofillUserlist()
@@ -623,9 +623,9 @@ void ScCopyPasteTest::tdf137653_137654_autofillUserlist()
     ScTabViewShell* pViewShell = ScDocShell::GetViewData()->GetViewShell();
 
     // delete every userlist to make sure there won't be any string that is in 
2 different userlist
-    ScGlobal::GetUserList()->clear();
+    ScGlobal::GetUserList().clear();
     addToUserList({ 
"January,February,March,April,May,June,July,August,September,October,November,December"
 });
-    const ScUserListData* pListData = 
ScGlobal::GetUserList()->GetData("January");
+    const ScUserListData* pListData = 
ScGlobal::GetUserList().GetData("January");
     sal_uInt16 nIdx1 = 0, nIdx2 = 0;
     bool bHasIdx1, bHasIdx2;
     bool bMatchCase = false;
@@ -733,9 +733,9 @@ void ScCopyPasteTest::tdf137625_autofillMergedUserlist()
     ScTabViewShell* pViewShell = ScDocShell::GetViewData()->GetViewShell();
 
     // delete every userlist to make sure there won't be any string that is in 
2 different userlist
-    ScGlobal::GetUserList()->clear();
+    ScGlobal::GetUserList().clear();
     addToUserList({ 
"January,February,March,April,May,June,July,August,September,October,November,December"
 });
-    const ScUserListData* pListData = 
ScGlobal::GetUserList()->GetData("January");
+    const ScUserListData* pListData = 
ScGlobal::GetUserList().GetData("January");
     sal_uInt16 nIdx1 = 0, nIdx2 = 0;
     bool bHasIdx1, bHasIdx2;
     bool bMatchCase = false;
@@ -794,7 +794,7 @@ void ScCopyPasteTest::tdf137624_autofillMergedMixed()
 
     // add 1aa,2bb,3cc,4dd,5ee,6ff to userlist, to test that autofill won't 
confuse it with 1aa,3aa
     // delete every userlist to make sure there won't be any string that is in 
2 different userlist
-    ScGlobal::GetUserList()->clear();
+    ScGlobal::GetUserList().clear();
     addToUserList({ "1aa,2bb,3cc,4dd,5ee,6ff" });
 
     // fillauto mixed (string + number), these areas contain only merged cells
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index a46f46b3cffb..a4f892b5c766 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -292,7 +292,7 @@ ScUnoAddInCollection* ScGlobal::GetAddInCollection()
     return comphelper::doubleCheckedInit( pAddInCollection, []() { return new 
ScUnoAddInCollection(); });
 }
 
-ScUserList* ScGlobal::GetUserList()
+ScUserList& ScGlobal::GetUserList()
 {
     assert(!bThreadedGroupCalcInProgress);
     // Hack: Load Cfg item at the App
@@ -300,7 +300,7 @@ ScUserList* ScGlobal::GetUserList()
 
     if (!xUserList)
         xUserList.reset(new ScUserList());
-    return xUserList.get();
+    return *xUserList;
 }
 
 void ScGlobal::SetUserList( const ScUserList* pNewList )
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index ee00f2d58161..f04bee9432f3 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -1494,10 +1494,10 @@ short ScTable::CompareCell(
                 bool bNaturalSort = aSortParam.bNaturalSort;    // natural sort
                 bool bCaseSens    = aSortParam.bCaseSens;       // case 
sensitivity
 
-                ScUserList* pList = ScGlobal::GetUserList();
-                if (bUserDef && pList && pList->size() > aSortParam.nUserIndex 
)
+                ScUserList& rList = ScGlobal::GetUserList();
+                if (bUserDef && rList.size() > aSortParam.nUserIndex)
                 {
-                    const ScUserListData& rData = 
(*pList)[aSortParam.nUserIndex];
+                    const ScUserListData& rData = rList[aSortParam.nUserIndex];
 
                     if ( bNaturalSort )
                         nRes = naturalsort::Compare( aStr1, aStr2, bCaseSens, 
&rData, pSortCollator );
diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index 438608dc8492..a6ddf796a7c6 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -447,7 +447,7 @@ void ScTable::FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL 
nCol2, SCROW nRow2,
                 OUString aStr = GetString(nColCurr, nRowCurr );
                 OUString aStr2;
 
-                rListData = 
const_cast<ScUserListData*>(ScGlobal::GetUserList()->GetData(aStr));
+                rListData = 
const_cast<ScUserListData*>(ScGlobal::GetUserList().GetData(aStr));
                 if (rListData)
                 {
                     bool bMatchCase = false;
@@ -684,7 +684,7 @@ void ScTable::FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL 
nCol2, SCROW nRow2,
     {
         OUString aStr = GetString(nCol, nRow);
 
-        rListData = 
const_cast<ScUserListData*>(ScGlobal::GetUserList()->GetData(aStr));
+        rListData = 
const_cast<ScUserListData*>(ScGlobal::GetUserList().GetData(aStr));
         if (rListData)
         {
             bool bMatchCase = false;
diff --git a/sc/source/core/tool/appoptio.cxx b/sc/source/core/tool/appoptio.cxx
index 0a4cb09503c1..c35524f9588f 100644
--- a/sc/source/core/tool/appoptio.cxx
+++ b/sc/source/core/tool/appoptio.cxx
@@ -141,18 +141,13 @@ static void lcl_GetLastFunctions( Any& rDest, const 
ScAppOptions& rOpt )
 
 static void lcl_GetSortList( Any& rDest )
 {
-    const ScUserList* pUserList = ScGlobal::GetUserList();
-    if (pUserList)
-    {
-        size_t nCount = pUserList->size();
-        Sequence<OUString> aSeq( nCount );
-        OUString* pArray = aSeq.getArray();
-        for (size_t i=0; i<nCount; ++i)
-            pArray[i] = 
(*pUserList)[sal::static_int_cast<sal_uInt16>(i)].GetString();
-        rDest <<= aSeq;
-    }
-    else
-        rDest <<= Sequence<OUString>(0);    // empty
+    const ScUserList& rUserList = ScGlobal::GetUserList();
+    size_t nCount = rUserList.size();
+    Sequence<OUString> aSeq( nCount );
+    OUString* pArray = aSeq.getArray();
+    for (size_t i=0; i<nCount; ++i)
+        pArray[i] = rUserList[sal::static_int_cast<sal_uInt16>(i)].GetString();
+    rDest <<= aSeq;
 }
 
 constexpr OUStringLiteral CFGPATH_LAYOUT = u"Office.Calc/Layout";
diff --git a/sc/source/filter/excel/excrecds.cxx 
b/sc/source/filter/excel/excrecds.cxx
index f18e9f829bbe..381836c10c12 100644
--- a/sc/source/filter/excel/excrecds.cxx
+++ b/sc/source/filter/excel/excrecds.cxx
@@ -1061,8 +1061,8 @@ ExcAutoFilterRecs::ExcAutoFilterRecs( const XclExpRoot& 
rRoot, SCTAB nTab, const
             ScSortParam aSortParam;
             pData->GetSortParam( aSortParam );
 
-            ScUserList* pList = ScGlobal::GetUserList();
-            if (aSortParam.bUserDef && pList && pList->size() > 
aSortParam.nUserIndex)
+            ScUserList& rList = ScGlobal::GetUserList();
+            if (aSortParam.bUserDef && rList.size() > aSortParam.nUserIndex)
             {
                 // get sorted area without headers
                 maSortRef = ScRange(
@@ -1070,7 +1070,7 @@ ExcAutoFilterRecs::ExcAutoFilterRecs( const XclExpRoot& 
rRoot, SCTAB nTab, const
                     aParam.nCol2, aParam.nRow2, aParam.nTab );
 
                 // get sorted columns with custom lists
-                const ScUserListData& rData = (*pList)[aSortParam.nUserIndex];
+                const ScUserListData& rData = rList[aSortParam.nUserIndex];
 
                 // get column index and sorting direction
                 SCCOLROW nField = 0;
diff --git a/sc/source/filter/oox/autofilterbuffer.cxx 
b/sc/source/filter/oox/autofilterbuffer.cxx
index ac1816c6eba6..2aaeae049be1 100644
--- a/sc/source/filter/oox/autofilterbuffer.cxx
+++ b/sc/source/filter/oox/autofilterbuffer.cxx
@@ -820,12 +820,12 @@ void AutoFilter::finalizeImport( const Reference< 
XDatabaseRange >& rxDatabaseRa
     aParam.nUserIndex = 0;
     aParam.bByRow = false;
 
-    ScUserList* pUserList = ScGlobal::GetUserList();
+    ScUserList& rUserList = ScGlobal::GetUserList();
     if (!rSorConditionLoaded.maSortCustomList.isEmpty())
     {
-        for (size_t i=0; pUserList && i < pUserList->size(); i++)
+        for (size_t i=0; i < rUserList.size(); i++)
         {
-            const OUString aEntry((*pUserList)[i].GetString());
+            const OUString aEntry(rUserList[i].GetString());
             if 
(aEntry.equalsIgnoreAsciiCase(rSorConditionLoaded.maSortCustomList))
             {
                 aParam.bUserDef = true;
@@ -837,9 +837,9 @@ void AutoFilter::finalizeImport( const Reference< 
XDatabaseRange >& rxDatabaseRa
 
     if (!aParam.bUserDef)
     {
-        pUserList->emplace_back(rSorConditionLoaded.maSortCustomList);
+        rUserList.emplace_back(rSorConditionLoaded.maSortCustomList);
         aParam.bUserDef = true;
-        aParam.nUserIndex = pUserList->size()-1;
+        aParam.nUserIndex = rUserList.size()-1;
     }
 
     // set sort parameter if we have detected it
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index 19b521feead9..65d85c499d55 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -1999,7 +1999,7 @@ std::optional<SfxItemSet> ScModule::CreateItemSet( 
sal_uInt16 nId )
                             : GetViewOptions();
 
         ScUserListItem  aULItem( SCITEM_USERLIST );
-        ScUserList*     pUL = ScGlobal::GetUserList();
+        const ScUserList& rUL = ScGlobal::GetUserList();
 
         //  SfxGetpApp()->GetOptions( aSet );
 
@@ -2048,11 +2048,8 @@ std::optional<SfxItemSet> ScModule::CreateItemSet( 
sal_uInt16 nId )
         pRet->Put( aViewOpt.CreateGridItem() );
 
         // TP_USERLISTS
-        if ( pUL )
-        {
-            aULItem.SetUserList( *pUL );
-            pRet->Put(aULItem);
-        }
+        aULItem.SetUserList(rUL);
+        pRet->Put(aULItem);
 
         // TP_COMPATIBILITY
         pRet->Put( SfxUInt16Item( SID_SC_OPT_KEY_BINDING_COMPAT,
diff --git a/sc/source/ui/dbgui/tpsort.cxx b/sc/source/ui/dbgui/tpsort.cxx
index a6050ecf8b3f..3cc3e90e3b22 100644
--- a/sc/source/ui/dbgui/tpsort.cxx
+++ b/sc/source/ui/dbgui/tpsort.cxx
@@ -750,15 +750,12 @@ DeactivateRC ScTabPageSortOptions::DeactivatePage( 
SfxItemSet* pSetP )
 
 void ScTabPageSortOptions::FillUserSortListBox()
 {
-    ScUserList* pUserLists = ScGlobal::GetUserList();
+    ScUserList& rUserLists = ScGlobal::GetUserList();
 
     m_xLbSortUser->clear();
-    if ( pUserLists )
-    {
-        size_t nCount = pUserLists->size();
-        for (size_t i=0; i<nCount; ++i)
-            m_xLbSortUser->append_text((*pUserLists)[i].GetString());
-    }
+    size_t nCount = rUserLists.size();
+    for (size_t i=0; i<nCount; ++i)
+        m_xLbSortUser->append_text(rUserLists[i].GetString());
 }
 
 // Handler:
diff --git a/sc/source/ui/dbgui/tpsubt.cxx b/sc/source/ui/dbgui/tpsubt.cxx
index dd8fabc534e7..4c123f7598c8 100644
--- a/sc/source/ui/dbgui/tpsubt.cxx
+++ b/sc/source/ui/dbgui/tpsubt.cxx
@@ -537,16 +537,13 @@ bool ScTpSubTotalOptions::FillItemSet( SfxItemSet* 
rArgSet )
 
 void ScTpSubTotalOptions::FillUserSortListBox()
 {
-    ScUserList* pUserLists = ScGlobal::GetUserList();
+    ScUserList& rUserLists = ScGlobal::GetUserList();
 
     m_xLbUserDef->freeze();
     m_xLbUserDef->clear();
-    if ( pUserLists )
-    {
-        size_t nCount = pUserLists->size();
-        for ( size_t i=0; i<nCount; ++i )
-            m_xLbUserDef->append_text((*pUserLists)[i].GetString() );
-    }
+    size_t nCount = rUserLists.size();
+    for ( size_t i=0; i<nCount; ++i )
+        m_xLbUserDef->append_text(rUserLists[i].GetString());
     m_xLbUserDef->thaw();
 }
 
diff --git a/sc/source/ui/unoobj/appluno.cxx b/sc/source/ui/unoobj/appluno.cxx
index 26457e43f1b9..3ea47324bf0b 100644
--- a/sc/source/ui/unoobj/appluno.cxx
+++ b/sc/source/ui/unoobj/appluno.cxx
@@ -248,17 +248,17 @@ void SAL_CALL ScSpreadsheetSettings::setPropertyValue(
     }
     else if (aPropertyName == SC_UNONAME_ULISTS)
     {
-        ScUserList* pUserList = ScGlobal::GetUserList();
+        ScUserList& rUserList = ScGlobal::GetUserList();
         uno::Sequence<OUString> aSeq;
-        if ( pUserList && ( aValue >>= aSeq ) )
+        if (aValue >>= aSeq)
         {
             //  directly change the active list
             //  ScGlobal::SetUseTabCol does not do much else
 
-            pUserList->clear();
+            rUserList.clear();
             for (const OUString& aEntry : aSeq)
             {
-                pUserList->emplace_back(aEntry);
+                rUserList.emplace_back(aEntry);
             }
             bSaveApp = true;    // List with App-Options are saved
         }
@@ -325,16 +325,13 @@ uno::Any SAL_CALL 
ScSpreadsheetSettings::getPropertyValue( const OUString& aProp
     }
     else if (aPropertyName == SC_UNONAME_ULISTS )
     {
-        ScUserList* pUserList = ScGlobal::GetUserList();
-        if (pUserList)
-        {
-            size_t nCount = pUserList->size();
-            uno::Sequence<OUString> aSeq(nCount);
-            OUString* pAry = aSeq.getArray();
-            for (size_t i=0; i<nCount; ++i)
-                pAry[i] = (*pUserList)[i].GetString();
-            aRet <<= aSeq;
-        }
+        const ScUserList& rUserList = ScGlobal::GetUserList();
+        size_t nCount = rUserList.size();
+        uno::Sequence<OUString> aSeq(nCount);
+        OUString* pAry = aSeq.getArray();
+        for (size_t i=0; i<nCount; ++i)
+            pAry[i] = rUserList[i].GetString();
+        aRet <<= aSeq;
     }
     else if (aPropertyName == SC_UNONAME_PRALLSH )
         aRet <<= pScMod->GetPrintOptions().GetAllSheets();
diff --git a/sc/source/ui/view/dbfunc3.cxx b/sc/source/ui/view/dbfunc3.cxx
index 58e02baca533..7a2ba764a3e1 100644
--- a/sc/source/ui/view/dbfunc3.cxx
+++ b/sc/source/ui/view/dbfunc3.cxx
@@ -1734,17 +1734,12 @@ void ScDBFunc::DataPilotSort(ScDPObject* pDPObj, 
tools::Long nDimIndex, bool bAs
         typedef std::unordered_map<OUString, sal_uInt16> UserSortMap;
         UserSortMap aSubStrs;
         sal_uInt16 nSubCount = 0;
-        ScUserList* pUserList = ScGlobal::GetUserList();
-        if (!pUserList)
+        ScUserList& rUserList = ScGlobal::GetUserList();
+        size_t nUserListSize = rUserList.size();
+        if (!nUserListSize || *pUserListId >= 
static_cast<sal_uInt16>(nUserListSize))
             return;
 
-        {
-            size_t n = pUserList->size();
-            if (!n || *pUserListId >= static_cast<sal_uInt16>(n))
-                return;
-        }
-
-        const ScUserListData& rData = (*pUserList)[*pUserListId];
+        const ScUserListData& rData = rUserList[*pUserListId];
         sal_uInt16 n = rData.GetSubCount();
         for (sal_uInt16 i = 0; i < n; ++i)
         {
diff --git a/sc/source/ui/view/gridwin2.cxx b/sc/source/ui/view/gridwin2.cxx
index 01f5f39dd7d3..5b85d3c66fd5 100644
--- a/sc/source/ui/view/gridwin2.cxx
+++ b/sc/source/ui/view/gridwin2.cxx
@@ -656,16 +656,13 @@ void 
ScGridWindow::DPSetupFieldPopup(std::unique_ptr<ScCheckListMenuControl::Ext
     if (bDimOrientNotPage)
     {
         vector<OUString> aUserSortNames;
-        ScUserList* pUserList = ScGlobal::GetUserList();
-        if (pUserList)
+        ScUserList& rUserList = ScGlobal::GetUserList();
+        size_t nUserListSize = rUserList.size();
+        aUserSortNames.reserve(nUserListSize);
+        for (size_t i = 0; i < nUserListSize; ++i)
         {
-            size_t n = pUserList->size();
-            aUserSortNames.reserve(n);
-            for (size_t i = 0; i < n; ++i)
-            {
-                const ScUserListData& rData = (*pUserList)[i];
-                aUserSortNames.push_back(rData.GetString());
-            }
+            const ScUserListData& rData = rUserList[i];
+            aUserSortNames.push_back(rData.GetString());
         }
 
         // Populate the menus.
commit 09c7447e27fcf4b28b51403273b542713006aac8
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Sun May 5 19:10:50 2024 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Mon May 6 12:23:19 2024 +0200

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

diff --git a/winaccessibility/source/UAccCOM/AccActionBase.cxx 
b/winaccessibility/source/UAccCOM/AccActionBase.cxx
index 0fb2d7bbcee6..0b7a652cef9f 100644
--- a/winaccessibility/source/UAccCOM/AccActionBase.cxx
+++ b/winaccessibility/source/UAccCOM/AccActionBase.cxx
@@ -65,7 +65,8 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP 
CAccActionBase::nActions(/*[out,retval]*/long*
         *nActions = pRXAct->getAccessibleActionCount();
         return S_OK;
     }
-    *nActions = 0;
+    if( nActions != nullptr )
+        *nActions = 0;
 
     return S_OK;
 
diff --git a/winaccessibility/source/UAccCOM/AccTable.cxx 
b/winaccessibility/source/UAccCOM/AccTable.cxx
index a158cf70667f..409db86273de 100644
--- a/winaccessibility/source/UAccCOM/AccTable.cxx
+++ b/winaccessibility/source/UAccCOM/AccTable.cxx
@@ -987,6 +987,7 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP 
CAccTable::get_selectedChildren(long, long **c
 
     *nChildren = nChildCount;
     *children = static_cast<long*>(CoTaskMemAlloc(nChildCount * sizeof(long)));
+    assert(*children && "Don't handle OOM conditions");
 
     for( sal_Int64 i = 0; i< nChildCount; i++)
     {
@@ -1049,6 +1050,7 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP 
CAccTable::get_selectedCells(IUnknown * * * ce
     *nSelectedCells = nSelected;
 
     *cells = static_cast<IUnknown**>(CoTaskMemAlloc(nSelected * 
sizeof(IUnknown*)));
+    assert(*cells && "Don't handle OOM conditions");
 
     for (sal_Int64 i = 0; i < nSelected; i++)
     {
diff --git a/winaccessibility/source/UAccCOM/AccTableCell.cxx 
b/winaccessibility/source/UAccCOM/AccTableCell.cxx
index 95725c2a4042..db6bc32fbbe9 100644
--- a/winaccessibility/source/UAccCOM/AccTableCell.cxx
+++ b/winaccessibility/source/UAccCOM/AccTableCell.cxx
@@ -109,6 +109,7 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP 
CAccTableCell::get_columnHeaderCells(IUnknown*
     const sal_Int32 nCount = xHeaders->getAccessibleRowCount();
     *pColumnHeaderCellCount = nCount;
     *cellAccessibles = static_cast<IUnknown**>(CoTaskMemAlloc(nCount * 
sizeof(IUnknown*)));
+    assert(*cellAccessibles && "Don't handle OOM conditions");
     sal_Int32 nCol = 0;
     get_columnIndex(&nCol);
     for (sal_Int32 nRow = 0; nRow < nCount; nRow++)
@@ -196,6 +197,7 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP 
CAccTableCell::get_rowHeaderCells(IUnknown***
     const sal_Int32 nCount = xHeaders->getAccessibleColumnCount();
     *pRowHeaderCellCount = nCount;
     *cellAccessibles = static_cast<IUnknown**>(CoTaskMemAlloc(nCount * 
sizeof(IUnknown*)));
+    assert(*cellAccessibles && "Don't handle OOM conditions");
     sal_Int32 nRow = 0;
     get_rowIndex(&nRow);
     for (sal_Int32 nCol = 0; nCol < nCount; nCol++)

Reply via email to