cui/source/dialogs/SpellDialog.cxx           |    5 ++++-
 editeng/source/misc/svxacorr.cxx             |   10 ++++++++--
 oox/source/drawingml/texteffectscontext.cxx  |    5 +++--
 reportdesign/source/filter/xml/xmlExport.cxx |    1 +
 sc/source/core/data/SolverSettings.cxx       |    4 +++-
 sc/source/ui/namedlg/namedefdlg.cxx          |    8 ++++++--
 soltools/mkdepend/collectdircontent.cxx      |    1 +
 sw/source/core/layout/paintfrm.cxx           |    2 +-
 vcl/source/cnttype/mcnttype.cxx              |    4 +++-
 9 files changed, 30 insertions(+), 10 deletions(-)

New commits:
commit bc95ece0618b9886890d9c758b9d0ebc0fc41c69
Author:     Julien Nabet <serval2...@yahoo.fr>
AuthorDate: Mon Dec 4 18:03:27 2023 +0100
Commit:     Julien Nabet <serval2...@yahoo.fr>
CommitDate: Mon Dec 4 19:21:31 2023 +0100

    cid#1546021 Using invalid iterator
    
    and :
    
    cid#1545983 Using invalid iterator
    cid#1545969 Using invalid iterator
    cid#1545949 Using invalid iterator
    cid#1545929 Using invalid iterator
    cid#1545911 Using invalid iterator
    cid#1545910 Using invalid iterator
    cid#1545886 Using invalid iterator
    cid#1545870 Using invalid iterator
    cid#1545813 Using invalid iterator
    
    Change-Id: I2ad10c2a9affd348050a4abe0917a90927a52547
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160317
    Tested-by: Jenkins
    Reviewed-by: Julien Nabet <serval2...@yahoo.fr>

diff --git a/cui/source/dialogs/SpellDialog.cxx 
b/cui/source/dialogs/SpellDialog.cxx
index 3ad9c2b196b0..dfdad984ec41 100644
--- a/cui/source/dialogs/SpellDialog.cxx
+++ b/cui/source/dialogs/SpellDialog.cxx
@@ -1247,7 +1247,10 @@ namespace
     void ExtractErrorDescription(const EECharAttrib& rEECharAttrib, 
SpellErrorDescription& rSpellErrorDescription)
     {
         css::uno::Sequence<css::uno::Any> aSequence;
-        static_cast<const 
SfxGrabBagItem*>(rEECharAttrib.pAttr)->GetGrabBag().find("SpellErrorDescription")->second
 >>= aSequence;
+        const auto pGrabBag = static_cast<const 
SfxGrabBagItem*>(rEECharAttrib.pAttr)->GetGrabBag();
+        const auto iter = pGrabBag.find("SpellErrorDescription");
+        assert(iter != pGrabBag.end());
+        iter->second >>= aSequence;
         rSpellErrorDescription.fromSequence(aSequence);
     }
 }
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 8a28ccf42ada..6fdcbcca1ccf 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -1750,7 +1750,11 @@ bool SvxAutoCorrect::AddWordStartException( const 
OUString& rNew,
         if (iter != m_aLangTable.end())
             pLists = &iter->second;
         else if(CreateLanguageFile(aLangTagUndetermined))
-            pLists = &m_aLangTable.find(aLangTagUndetermined)->second;
+        {
+            iter = m_aLangTable.find(aLangTagUndetermined);
+            assert(iter != m_aLangTable.end());
+            pLists = &iter->second;
+        }
     }
     OSL_ENSURE(pLists, "No auto correction file!");
     return pLists && pLists->AddToWordStartExceptList(rNew);
@@ -2030,7 +2034,9 @@ const SvxAutocorrWord* SvxAutoCorrect::SearchWordsInList(
             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 )
         {
diff --git a/oox/source/drawingml/texteffectscontext.cxx 
b/oox/source/drawingml/texteffectscontext.cxx
index 0e33a4c3c13b..347971f4616b 100644
--- a/oox/source/drawingml/texteffectscontext.cxx
+++ b/oox/source/drawingml/texteffectscontext.cxx
@@ -91,8 +91,9 @@ OUString const & lclGetGrabBagName(sal_uInt32 aId)
         { OOX_TOKEN(w14, stylisticSets), "CharStylisticSetsTextEffect" },
         { OOX_TOKEN(w14, cntxtAlts)    , "CharCntxtAltsTextEffect" },
     };
-
-    return aGrabBagNameMap.find(aId)->second;
+    const auto iter = aGrabBagNameMap.find(aId);
+    assert(iter != aGrabBagNameMap.end());
+    return iter->second;
 }
 
 }
diff --git a/reportdesign/source/filter/xml/xmlExport.cxx 
b/reportdesign/source/filter/xml/xmlExport.cxx
index 6e7104724704..c1b2c24232d9 100644
--- a/reportdesign/source/filter/xml/xmlExport.cxx
+++ b/reportdesign/source/filter/xml/xmlExport.cxx
@@ -755,6 +755,7 @@ void ORptExport::exportContainer(const Reference< 
XSection>& _xSection)
     TGrid::const_iterator aRowEnd = aFind->second.end();
 
     TGridStyleMap::const_iterator aRowFind = m_aRowStyleNames.find(_xSection);
+    assert(aRowFind != m_aRowStyleNames.end());
     auto aHeightIter = aRowFind->second.cbegin();
     OSL_ENSURE(aRowFind->second.size() == aFind->second.size(),"Different 
count for rows");
 
diff --git a/sc/source/core/data/SolverSettings.cxx 
b/sc/source/core/data/SolverSettings.cxx
index ac2d2aa24aeb..60eb747f55f5 100644
--- a/sc/source/core/data/SolverSettings.cxx
+++ b/sc/source/core/data/SolverSettings.cxx
@@ -368,7 +368,9 @@ void SolverSettings::WriteParamValue(SolverParameter 
eParam, OUString sValue, bo
     if (bQuoted)
         ScGlobal::AddQuotes(sValue, '"');
 
-    OUString sRange = m_mNamedRanges.find(eParam)->second;
+    const auto iter = m_mNamedRanges.find(eParam);
+    assert(iter != m_mNamedRanges.end());
+    OUString sRange = iter->second;
     ScRangeData* pNewEntry = new ScRangeData(m_rDoc, sRange, sValue);
     m_pRangeName->insert(pNewEntry);
 }
diff --git a/sc/source/ui/namedlg/namedefdlg.cxx 
b/sc/source/ui/namedlg/namedefdlg.cxx
index 764e6fa2e6bc..5be3ddc7de25 100644
--- a/sc/source/ui/namedlg/namedefdlg.cxx
+++ b/sc/source/ui/namedlg/namedefdlg.cxx
@@ -186,11 +186,15 @@ void ScNameDefDlg::AddPushed()
     ScRangeName* pRangeName = nullptr;
     if(aScope == maGlobalNameStr)
     {
-        pRangeName = maRangeMap.find(STR_GLOBAL_RANGE_NAME)->second;
+        const auto iter = maRangeMap.find(STR_GLOBAL_RANGE_NAME);
+        assert(iter != maRangeMap.end());
+        pRangeName = iter->second;
     }
     else
     {
-        pRangeName = maRangeMap.find(aScope)->second;
+        const auto iter = maRangeMap.find(aScope);
+        assert(iter != maRangeMap.end());
+        pRangeName = iter->second;
     }
     if (!pRangeName)
         return;
diff --git a/soltools/mkdepend/collectdircontent.cxx 
b/soltools/mkdepend/collectdircontent.cxx
index c5e910c2e7bf..2f64520b773a 100644
--- a/soltools/mkdepend/collectdircontent.cxx
+++ b/soltools/mkdepend/collectdircontent.cxx
@@ -68,6 +68,7 @@ bool IncludesCollection::exists(std::string filePath) {
         add_to_collection(dirPath);
         mapIter = allIncludes.find(dirPath);
     }
+    assert(mapIter != allIncludes.end());
     DirContent dirContent = (*mapIter).second;
     DirContent::iterator dirIter = dirContent.find(fileName);
     return dirIter != dirContent.end();
diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index d4e6f872c848..aecd7edc3440 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -2775,7 +2775,7 @@ void SwTabFramePainter::FindStylesForLine( Point& 
rStartPoint,
     if ( bHori )
     {
         aMapIter = maVertLines.find( rEndPoint.X() );
-        OSL_ENSURE( aMapIter != maVertLines.end(), "FindStylesForLine: Error" 
);
+        assert(aMapIter != maVertLines.end() && "FindStylesForLine: Error");
         const SwLineEntrySet& rVertSet2 = (*aMapIter).second;
 
         for ( const SwLineEntry& rEntry : rVertSet2 )
diff --git a/vcl/source/cnttype/mcnttype.cxx b/vcl/source/cnttype/mcnttype.cxx
index f41f5d25ea3a..cc5facf17717 100644
--- a/vcl/source/cnttype/mcnttype.cxx
+++ b/vcl/source/cnttype/mcnttype.cxx
@@ -63,7 +63,9 @@ OUString SAL_CALL CMimeContentType::getParameterValue( const 
OUString& aName )
     if ( !hasParameter( lower ) )
         throw css::container::NoSuchElementException( );
 
-    return m_ParameterMap.find( lower )->second;
+    const auto iter = m_ParameterMap.find(lower);
+    assert(iter != m_ParameterMap.end());
+    return iter->second;
 }
 
 void CMimeContentType::init( const OUString& aCntType )

Reply via email to