codemaker/source/cppumaker/cpputype.cxx  |    4 +++-
 editeng/source/misc/svxacorr.cxx         |   16 ++++++++++++----
 sd/source/filter/eppt/pptx-epptooxml.cxx |    6 +++++-
 svx/source/form/fmshimp.cxx              |    3 +--
 sw/source/core/layout/paintfrm.cxx       |    2 +-
 vcl/source/treelist/treelist.cxx         |    4 +++-
 6 files changed, 25 insertions(+), 10 deletions(-)

New commits:
commit 12b96aca8666bca5bf905c8c9da44a20e0c06ef3
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Thu Dec 7 08:49:19 2023 +0000
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Thu Dec 7 18:22:46 2023 +0100

    cid#1546503 Using invalid iterator
    
    and
    
    cid#1546284 Using invalid iterator
    cid#1546275 Using invalid iterator
    cid#1546049 Using invalid iterator
    cid#1545929 Using invalid iterator
    cid#1545870 Using invalid iterator
    cid#1545668 Using invalid iterator
    cid#1545420 Using invalid iterator
    
    Change-Id: I3ad3000631b4be5917b9c5f49f21b8cc003a309c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159056
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/codemaker/source/cppumaker/cpputype.cxx 
b/codemaker/source/cppumaker/cpputype.cxx
index 1995ed73c9ea..c67772eb2e88 100644
--- a/codemaker/source/cppumaker/cpputype.cxx
+++ b/codemaker/source/cppumaker/cpputype.cxx
@@ -2850,7 +2850,9 @@ void 
PolyStructType::dumpComprehensiveGetCppuType(FileStream & out)
          i != entity_->getMembers().end();) {
         out << indent() << "{ { ";
         if (i->parameterized) {
-            sal_uInt32 k = parameters.find(i->type)->second;
+            const auto iter = parameters.find(i->type);
+            assert(iter != parameters.end());
+            sal_uInt32 k = iter->second;
             out << "the_pclass" << k << ", the_pname" << k << ".pData";
         } else {
             const auto iter = types.find(i->type);
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 2788c6694c09..f6941d6cc371 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -2008,7 +2008,9 @@ const SvxAutocorrWord* SvxAutoCorrect::SearchWordsInList(
     if (m_aLangTable.find(aLanguageTag) != m_aLangTable.end() || 
CreateLanguageFile(aLanguageTag, false))
     {
         //the language is available - so bring it on
-        SvxAutoCorrectLanguageLists & rList = 
m_aLangTable.find(aLanguageTag)->second;
+        const auto iter = m_aLangTable.find(aLanguageTag);
+        assert(iter != m_aLangTable.end());
+        SvxAutoCorrectLanguageLists & rList = iter->second;
         pRet = lcl_SearchWordsInList( &rList, rTxt, rStt, nEndPos );
         if( pRet )
         {
@@ -2068,7 +2070,9 @@ bool SvxAutoCorrect::FindInWordStartExceptList( 
LanguageType eLang,
     if (m_aLangTable.find(aLanguageTag) != m_aLangTable.end() || 
CreateLanguageFile(aLanguageTag, false))
     {
         //the language is available - so bring it on
-        auto& rList = m_aLangTable.find(aLanguageTag)->second;
+        const auto iter = m_aLangTable.find(aLanguageTag);
+        assert(iter != m_aLangTable.end() && "CreateLanguageFile can't fail");
+        auto& rList = iter->second;
         if(rList.GetWordStartExceptList()->find(sWord) != 
rList.GetWordStartExceptList()->end() )
             return true;
     }
@@ -2082,7 +2086,9 @@ bool SvxAutoCorrect::FindInWordStartExceptList( 
LanguageType eLang,
                  CreateLanguageFile(aLanguageTag, false)))
     {
         //the language is available - so bring it on
-        auto& rList = m_aLangTable.find(aLanguageTag)->second;
+        const auto iter = m_aLangTable.find(aLanguageTag);
+        assert(iter != m_aLangTable.end() && "CreateLanguageFile can't fail");
+        auto& rList = iter->second;
         if(rList.GetWordStartExceptList()->find(sWord) != 
rList.GetWordStartExceptList()->end() )
             return true;
     }
@@ -2162,7 +2168,9 @@ bool SvxAutoCorrect::FindInCplSttExceptList(LanguageType 
eLang,
                  CreateLanguageFile(aLanguageTag, false)))
     {
         //the language is available - so bring it on
-        const SvStringsISortDtor* pList = 
m_aLangTable.find(aLanguageTag)->second.GetCplSttExceptList();
+        const auto iter = m_aLangTable.find(aLanguageTag);
+        assert(iter != m_aLangTable.end() && "CreateLanguageFile can't fail");
+        const SvStringsISortDtor* pList = iter->second.GetCplSttExceptList();
         if(bAbbreviation ? lcl_FindAbbreviation(pList, sWord) : 
pList->find(sWord) != pList->end() )
             return true;
     }
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx 
b/sd/source/filter/eppt/pptx-epptooxml.cxx
index 291565871ff2..d9ae8b1a64c2 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -2306,9 +2306,13 @@ void 
PowerPointExport::WritePlaceholderReferenceShapes(PowerPointShapeExport& rD
             && (aAny >>= aText) && !aText.isEmpty()))
     {
         if ((xShape = GetReferencedPlaceholderXShape(Footer, ePageType)))
+        {
+            const auto iter = maPlaceholderShapeToIndexMap.find(xShape);
+            assert(iter != maPlaceholderShapeToIndexMap.end());
             rDML.WritePlaceholderReferenceShape(Footer,
-                                                
maPlaceholderShapeToIndexMap.find(xShape)->second,
+                                                iter->second,
                                                 ePageType, mXPagePropSet);
+        }
     }
 
     if (ePageType == LAYOUT
diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx
index 5dce31f180ba..d54c5acaebde 100644
--- a/svx/source/form/fmshimp.cxx
+++ b/svx/source/form/fmshimp.cxx
@@ -3402,8 +3402,7 @@ void FmXFormShell::CreateExternalView_Lock()
                 // column position
                 pDispatchArgs->Name = FMARG_ADDCOL_COLUMNPOS;
                 FmMapUString2Int16::const_iterator aOffset = 
aRadioPositions.find(rCtrlSource.first);
-                DBG_ASSERT(aOffset != aRadioPositions.end(),
-                    "FmXFormShell::CreateExternalView : inconsistent radio 
descriptions !");
+                assert(aOffset != aRadioPositions.end() && 
"FmXFormShell::CreateExternalView : inconsistent radio descriptions !");
                 sal_Int16 nPosition = (*aOffset).second;
                 nPosition = nPosition + nOffset;
                     // we already inserted nOffset additional columns...
diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index aecd7edc3440..0f048c4e805d 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -2794,7 +2794,7 @@ void SwTabFramePainter::FindStylesForLine( Point& 
rStartPoint,
     else
     {
         aMapIter = maHoriLines.find( rEndPoint.Y() );
-        OSL_ENSURE( aMapIter != maHoriLines.end(), "FindStylesForLine: Error" 
);
+        assert(aMapIter != maHoriLines.end() && "FindStylesForLine: Error");
         const SwLineEntrySet& rHoriSet2 = (*aMapIter).second;
 
         for ( const SwLineEntry& rEntry : rHoriSet2 )
diff --git a/vcl/source/treelist/treelist.cxx b/vcl/source/treelist/treelist.cxx
index a1ebf4d3743c..9d1aa62bd274 100644
--- a/vcl/source/treelist/treelist.cxx
+++ b/vcl/source/treelist/treelist.cxx
@@ -1220,7 +1220,9 @@ void SvListView::Impl::ActionRemoving( SvTreeListEntry* 
pEntry )
     SvTreeListEntry* pCurEntry = pEntry->pParent;
     if (pCurEntry && pCurEntry != m_rThis.pModel->pRootItem.get() && 
pCurEntry->m_Children.size() == 1)
     {
-        pViewData = m_DataTable.find(pCurEntry)->second.get();
+        SvDataTable::iterator itr = m_DataTable.find(pCurEntry);
+        assert(itr != m_DataTable.end() && "Entry not in Table");
+        pViewData = itr->second.get();
         pViewData->SetExpanded(false);
     }
 }

Reply via email to