summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2023-12-03 19:22:07 +0000
committerCaolán McNamara <caolan.mcnamara@collabora.com>2023-12-03 22:12:17 +0100
commit44739ff1ee17eb8baf39fd8e40e686fbf31bcf4a (patch)
treedd110e9dd6d710ee544adfa2ca02dcbd7f36cd85
parent5f17c6385fbff08ec72eab3fde6121c488bc1149 (diff)
cid#1546503 Using invalid iterator
and: cid#1546480 Using invalid iterator cid#1546479 Using invalid iterator cid#1546454 Using invalid iterator cid#1546419 Using invalid iterator cid#1546410 Using invalid iterator cid#1546150 Using invalid iterator cid#1546039 Using invalid iterator cid#1545831 Using invalid iterator cid#1545736 Using invalid iterator cid#1545701 Using invalid iterator cid#1545630 Using invalid iterator cid#1545381 Using invalid iterator Change-Id: I9e151b623f751ee1e982b5da0011ff08ab0ad5e1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160270 Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
-rw-r--r--cppu/source/uno/lbenv.cxx2
-rw-r--r--cui/source/customize/macropg.cxx2
-rw-r--r--dbaccess/source/core/api/KeySet.cxx1
-rw-r--r--editeng/source/misc/svxacorr.cxx4
-rw-r--r--svx/source/items/customshapeitem.cxx1
-rw-r--r--vcl/source/treelist/treelist.cxx6
-rw-r--r--vcl/unx/gtk3/gtkinst.cxx24
7 files changed, 30 insertions, 10 deletions
diff --git a/cppu/source/uno/lbenv.cxx b/cppu/source/uno/lbenv.cxx
index f9d6633b2bed..472feae34b4e 100644
--- a/cppu/source/uno/lbenv.cxx
+++ b/cppu/source/uno/lbenv.cxx
@@ -346,7 +346,7 @@ static void s_stub_defenv_revokeInterface(va_list * pParam)
Ptr2ObjectMap::const_iterator const iFind(
that->aPtr2ObjectMap.find( pInterface ) );
- OSL_ASSERT( iFind != that->aPtr2ObjectMap.end() );
+ assert(iFind != that->aPtr2ObjectMap.end());
ObjectEntry * pOEntry = iFind->second;
if (! --pOEntry->nRef)
{
diff --git a/cui/source/customize/macropg.cxx b/cui/source/customize/macropg.cxx
index 79b54eb941ef..79197be4bf43 100644
--- a/cui/source/customize/macropg.cxx
+++ b/cui/source/customize/macropg.cxx
@@ -514,12 +514,14 @@ IMPL_LINK_NOARG(SvxMacroTabPage_, DeleteAllHdl_Impl, weld::Button&, void)
if (bAppEvents)
{
EventsHash::iterator h_it = m_appEventsHash.find(sEventName);
+ assert(h_it != m_appEventsHash.end());
h_it->second.first = sEventType;
h_it->second.second = sEmptyString;
}
else
{
EventsHash::iterator h_it = m_docEventsHash.find(sEventName);
+ assert(h_it != m_docEventsHash.end());
h_it->second.first = sEventType;
h_it->second.second = sEmptyString;
}
diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx
index d075dea04985..7a2ec55fa5c2 100644
--- a/dbaccess/source/core/api/KeySet.cxx
+++ b/dbaccess/source/core/api/KeySet.cxx
@@ -583,6 +583,7 @@ void OKeySet::executeUpdate(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rO
{
const sal_Int32 nBookmark = ::comphelper::getINT32((*_rInsertRow)[0].getAny());
m_aKeyIter = m_aKeyMap.find(nBookmark);
+ assert(m_aKeyIter != m_aKeyMap.end());
m_aKeyIter->second.second.first = 2;
m_aKeyIter->second.second.second = xRow;
copyRowValue(_rInsertRow,m_aKeyIter->second.first,nBookmark);
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index ab8a43091b00..61bc805993ce 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -2153,7 +2153,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/svx/source/items/customshapeitem.cxx b/svx/source/items/customshapeitem.cxx
index 7fc4a0601d30..84e9af4de2b8 100644
--- a/svx/source/items/customshapeitem.cxx
+++ b/svx/source/items/customshapeitem.cxx
@@ -208,6 +208,7 @@ void SdrCustomShapeGeometryItem::ClearPropertyValue( const OUString& rPropName )
if ( nIndex != ( nLength - 1 ) ) // resizing sequence
{
PropertyHashMap::iterator aHashIter2( m_aPropHashMap.find( m_aPropSeq[ nLength - 1 ].Name ) );
+ assert(aHashIter2 != m_aPropHashMap.end());
(*aHashIter2).second = nIndex;
pPropSeq[ nIndex ] = m_aPropSeq[ nLength - 1 ];
}
diff --git a/vcl/source/treelist/treelist.cxx b/vcl/source/treelist/treelist.cxx
index 9cc441d2c249..f7eb41311912 100644
--- a/vcl/source/treelist/treelist.cxx
+++ b/vcl/source/treelist/treelist.cxx
@@ -1124,7 +1124,9 @@ void SvListView::Impl::ActionMoving( SvTreeListEntry* pEntry )
DBG_ASSERT(pParent,"Model not consistent");
if (pParent != m_rThis.pModel->pRootItem.get() && pParent->m_Children.size() == 1)
{
- SvViewDataEntry* pViewData = m_DataTable.find( pParent )->second.get();
+ const auto iter = m_DataTable.find(pParent);
+ assert(iter != m_DataTable.end());
+ SvViewDataEntry* pViewData = iter->second.get();
pViewData->SetExpanded(false);
}
// preliminary
@@ -1320,7 +1322,7 @@ void SvListView::SetEntryFocus( SvTreeListEntry* pEntry, bool bFocus )
{
DBG_ASSERT(pEntry,"SetEntryFocus:No Entry");
SvDataTable::iterator itr = m_pImpl->m_DataTable.find(pEntry);
- DBG_ASSERT(itr != m_pImpl->m_DataTable.end(),"Entry not in Table");
+ assert(itr != m_pImpl->m_DataTable.end() && "Entry not in Table");
itr->second->SetFocus(bFocus);
}
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 04e46f12d132..bf78cf85eeff 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -15565,7 +15565,9 @@ public:
else
col = to_internal_model(col);
- if (get_bool(pos, m_aToggleTriStateMap.find(col)->second))
+ const auto iter = m_aToggleTriStateMap.find(col);
+ assert(iter != m_aToggleTriStateMap.end());
+ if (get_bool(pos, iter->second))
return TRISTATE_INDET;
return get_bool(pos, col) ? TRISTATE_TRUE : TRISTATE_FALSE;
}
@@ -15578,7 +15580,9 @@ public:
col = to_internal_model(col);
const GtkInstanceTreeIter& rGtkIter = static_cast<const GtkInstanceTreeIter&>(rIter);
- if (get_bool(rGtkIter.iter, m_aToggleTriStateMap.find(col)->second))
+ const auto iter = m_aToggleTriStateMap.find(col);
+ assert(iter != m_aToggleTriStateMap.end());
+ if (get_bool(rGtkIter.iter, iter->second))
return TRISTATE_INDET;
return get_bool(rGtkIter.iter, col) ? TRISTATE_TRUE : TRISTATE_FALSE;
}
@@ -15641,13 +15645,17 @@ public:
{
const GtkInstanceTreeIter& rGtkIter = static_cast<const GtkInstanceTreeIter&>(rIter);
col = to_internal_model(col);
- return get_int(rGtkIter.iter, m_aWeightMap.find(col)->second) == PANGO_WEIGHT_BOLD;
+ const auto iter = m_aWeightMap.find(col);
+ assert(iter != m_aWeightMap.end());
+ return get_int(rGtkIter.iter, iter->second) == PANGO_WEIGHT_BOLD;
}
virtual bool get_text_emphasis(int pos, int col) const override
{
col = to_internal_model(col);
- return get_int(pos, m_aWeightMap.find(col)->second) == PANGO_WEIGHT_BOLD;
+ const auto iter = m_aWeightMap.find(col);
+ assert(iter != m_aWeightMap.end());
+ return get_int(pos, iter->second) == PANGO_WEIGHT_BOLD;
}
virtual void set_text_align(const weld::TreeIter& rIter, double fAlign, int col) override
@@ -15683,7 +15691,9 @@ public:
virtual bool get_sensitive(int pos, int col) const override
{
col = to_internal_model(col);
- return get_bool(pos, m_aSensitiveMap.find(col)->second);
+ const auto iter = m_aSensitiveMap.find(col);
+ assert(iter != m_aSensitiveMap.end());
+ return get_bool(pos, iter->second);
}
virtual void set_sensitive(const weld::TreeIter& rIter, bool bSensitive, int col) override
@@ -15705,7 +15715,9 @@ public:
{
const GtkInstanceTreeIter& rGtkIter = static_cast<const GtkInstanceTreeIter&>(rIter);
col = to_internal_model(col);
- return get_bool(rGtkIter.iter, m_aSensitiveMap.find(col)->second);
+ const auto iter = m_aSensitiveMap.find(col);
+ assert(iter != m_aSensitiveMap.end());
+ return get_bool(rGtkIter.iter, iter->second);
}
void set_image(const GtkTreeIter& iter, int col, GdkPixbuf* pixbuf)