diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2023-12-04 18:59:43 +0100 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2023-12-04 22:10:20 +0100 |
commit | 67c2a4786154a5c246998f119c3349e4d725e43b (patch) | |
tree | 57885eb692217e500373220564cbd1e3dff9c2e4 | |
parent | 8472365774b7471e96a025f424a6c7eb7b02db26 (diff) |
cid#1545597 Using invalid iterator
and :
cid#1545537 Using invalid iterator
cid#1545508 Using invalid iterator
cid#1545494 Using invalid iterator
cid#1545478 Using invalid iterator
cid#1545427 Using invalid iterator
cid#1545420 Using invalid iterator
cid#1545400 Using invalid iterator
cid#1545300 Using invalid iterator
cid#1545258 Using invalid iterator
cid#1545257 Using invalid iterator
cid#1545200 Using invalid iterator
cid#1545183 Using invalid iterator
Change-Id: Ibf3a41902f34286967195c5c3b22e337a4b06809
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160322
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
-rw-r--r-- | codemaker/source/cppumaker/cpputype.cxx | 8 | ||||
-rw-r--r-- | dbaccess/source/core/api/KeySet.cxx | 4 | ||||
-rw-r--r-- | editeng/source/misc/svxacorr.cxx | 10 | ||||
-rw-r--r-- | forms/source/xforms/propertysetbase.cxx | 2 | ||||
-rw-r--r-- | oox/source/drawingml/texteffectscontext.cxx | 5 | ||||
-rw-r--r-- | sc/source/ui/namedlg/namedlg.cxx | 12 | ||||
-rw-r--r-- | sdext/source/pdfimport/tree/pdfiprocessor.cxx | 1 | ||||
-rw-r--r-- | slideshow/source/engine/box2dtools.cxx | 5 | ||||
-rw-r--r-- | stoc/source/invocation_adapterfactory/iafactory.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/utlui/uitool.cxx | 9 | ||||
-rw-r--r-- | toolkit/source/controls/unocontrolmodel.cxx | 4 |
11 files changed, 45 insertions, 17 deletions
diff --git a/codemaker/source/cppumaker/cpputype.cxx b/codemaker/source/cppumaker/cpputype.cxx index 301714911a3b..1995ed73c9ea 100644 --- a/codemaker/source/cppumaker/cpputype.cxx +++ b/codemaker/source/cppumaker/cpputype.cxx @@ -2279,8 +2279,10 @@ void PlainStructType::dumpComprehensiveGetCppuType(FileStream & out) for (std::vector< unoidl::PlainStructTypeEntity::Member >::const_iterator i( entity_->getDirectMembers().begin()); i != entity_->getDirectMembers().end();) { + const auto iter = types.find(i->type); + assert(iter != types.end()); out << indent() << "{ { " << getTypeClass(i->type, true) - << ", the_tname" << types.find(i->type)->second + << ", the_tname" << iter->second << ".pData, the_name" << n++ << ".pData }, false }"; ++i; out << (i == entity_->getDirectMembers().end() ? " };" : ",") << "\n"; @@ -2851,8 +2853,10 @@ void PolyStructType::dumpComprehensiveGetCppuType(FileStream & out) sal_uInt32 k = parameters.find(i->type)->second; out << "the_pclass" << k << ", the_pname" << k << ".pData"; } else { + const auto iter = types.find(i->type); + assert(iter != types.end()); out << getTypeClass(i->type, true) << ", the_tname" - << types.find(i->type)->second << ".pData"; + << iter->second << ".pData"; } out << ", the_name" << n++ << ".pData }, " << (i->parameterized ? "true" : "false") << " }"; diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx index 7a2ec55fa5c2..cfbec6afecef 100644 --- a/dbaccess/source/core/api/KeySet.cxx +++ b/dbaccess/source/core/api/KeySet.cxx @@ -912,7 +912,9 @@ void OKeySet::deleteRow(const ORowSetRow& _rDeleteRow,const connectivity::OSQLTa if(m_bDeleted) { sal_Int32 nBookmark = ::comphelper::getINT32((*_rDeleteRow)[0].getAny()); - if(m_aKeyIter == m_aKeyMap.find(nBookmark) && m_aKeyIter != m_aKeyMap.end()) + const auto iter = m_aKeyMap.find(nBookmark); + assert(iter != m_aKeyMap.end()); + if(m_aKeyIter == iter && m_aKeyIter != m_aKeyMap.end()) ++m_aKeyIter; m_aKeyMap.erase(nBookmark); m_bDeleted = true; diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index c8891889b01d..15cbecc32db3 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -1687,7 +1687,9 @@ SvxAutoCorrectLanguageLists& SvxAutoCorrect::GetLanguageList_( LanguageTag aLanguageTag( eLang); if (m_aLangTable.find(aLanguageTag) == m_aLangTable.end()) (void)CreateLanguageFile(aLanguageTag); - return m_aLangTable.find(aLanguageTag)->second; + const auto iter = m_aLangTable.find(aLanguageTag); + assert(iter != m_aLangTable.end()); + return iter->second; } void SvxAutoCorrect::SaveCplSttExceptList( LanguageType eLang ) @@ -1912,14 +1914,16 @@ void SvxAutoCorrect::MakeCombinedChanges( std::vector<SvxAutocorrWord>& aNewEntr LanguageType eLang ) { LanguageTag aLanguageTag( eLang); - auto const iter = m_aLangTable.find(aLanguageTag); + auto iter = m_aLangTable.find(aLanguageTag); if (iter != m_aLangTable.end()) { iter->second.MakeCombinedChanges( aNewEntries, aDeleteEntries ); } else if(CreateLanguageFile( aLanguageTag )) { - m_aLangTable.find( aLanguageTag )->second.MakeCombinedChanges( aNewEntries, aDeleteEntries ); + iter = m_aLangTable.find(aLanguageTag); + assert(iter != m_aLangTable.end()); + iter->second.MakeCombinedChanges( aNewEntries, aDeleteEntries ); } } diff --git a/forms/source/xforms/propertysetbase.cxx b/forms/source/xforms/propertysetbase.cxx index 0b0787c49c3e..0e19bfe968bc 100644 --- a/forms/source/xforms/propertysetbase.cxx +++ b/forms/source/xforms/propertysetbase.cxx @@ -120,7 +120,7 @@ void PropertySetBase::initializePropertyValueCache( sal_Int32 nHandle ) PropertyAccessorBase& PropertySetBase::locatePropertyHandler( sal_Int32 nHandle ) const { PropertyAccessors::const_iterator aPropertyPos = m_aAccessors.find( nHandle ); - OSL_ENSURE( aPropertyPos != m_aAccessors.end() && aPropertyPos->second, + assert( aPropertyPos != m_aAccessors.end() && aPropertyPos->second && "PropertySetBase::locatePropertyHandler: accessor map is corrupted!" ); // neither should this be called for handles where there is no accessor, nor should a // NULL accessor be in the map diff --git a/oox/source/drawingml/texteffectscontext.cxx b/oox/source/drawingml/texteffectscontext.cxx index 347971f4616b..25df357f5a06 100644 --- a/oox/source/drawingml/texteffectscontext.cxx +++ b/oox/source/drawingml/texteffectscontext.cxx @@ -70,8 +70,9 @@ OUString const & lclGetNameForElementId(sal_uInt32 aId) { OOX_TOKEN(w14, stylisticSets), "stylisticSets" }, { OOX_TOKEN(w14, cntxtAlts) , "cntxtAlts" }, }; - - return aIdMap.find(aId)->second; + const auto iter = aIdMap.find(aId); + assert(iter != aIdMap.end()); + return iter->second; } OUString const & lclGetGrabBagName(sal_uInt32 aId) diff --git a/sc/source/ui/namedlg/namedlg.cxx b/sc/source/ui/namedlg/namedlg.cxx index 3d7077699e49..a6a182cd82d9 100644 --- a/sc/source/ui/namedlg/namedlg.cxx +++ b/sc/source/ui/namedlg/namedlg.cxx @@ -280,9 +280,17 @@ bool ScNameDlg::IsFormulaValid() ScRangeName* ScNameDlg::GetRangeName(const OUString& rScope) { if (rScope == maGlobalNameStr) - return &m_RangeMap.find(STR_GLOBAL_RANGE_NAME)->second; + { + const auto iter = m_RangeMap.find(STR_GLOBAL_RANGE_NAME); + assert(iter != m_RangeMap.end()); + return &iter->second; + } else - return &m_RangeMap.find(rScope)->second; + { + const auto iter = m_RangeMap.find(rScope); + assert(iter != m_RangeMap.end()); + return &iter->second; + } } void ScNameDlg::ShowOptions(const ScRangeNameLine& rLine) diff --git a/sdext/source/pdfimport/tree/pdfiprocessor.cxx b/sdext/source/pdfimport/tree/pdfiprocessor.cxx index bf590c544334..44485f4c2525 100644 --- a/sdext/source/pdfimport/tree/pdfiprocessor.cxx +++ b/sdext/source/pdfimport/tree/pdfiprocessor.cxx @@ -497,6 +497,7 @@ const GraphicsContext& PDFIProcessor::getGraphicsContext( sal_Int32 nGCId ) cons auto it = m_aIdToGC.find( nGCId ); if( it == m_aIdToGC.end() ) it = m_aIdToGC.find( 0 ); + assert(it != m_aIdToGC.end()); return it->second; } diff --git a/slideshow/source/engine/box2dtools.cxx b/slideshow/source/engine/box2dtools.cxx index e831211d7704..f747786d78a2 100644 --- a/slideshow/source/engine/box2dtools.cxx +++ b/slideshow/source/engine/box2dtools.cxx @@ -683,7 +683,10 @@ Box2DBodySharedPtr makeBodyDynamic(const Box2DBodySharedPtr& pBox2DBody) Box2DBodySharedPtr box2DWorld::makeShapeStatic(const slideshow::internal::ShapeSharedPtr& pShape) { assert(mpBox2DWorld); - Box2DBodySharedPtr pBox2DBody = mpXShapeToBodyMap.find(pShape->getXShape())->second; + assert(pShape && pShape->getXShape()); + const auto iter = mpXShapeToBodyMap.find(pShape->getXShape()); + assert(iter != mpXShapeToBodyMap.end()); + Box2DBodySharedPtr pBox2DBody = iter->second; return makeBodyStatic(pBox2DBody); } diff --git a/stoc/source/invocation_adapterfactory/iafactory.cxx b/stoc/source/invocation_adapterfactory/iafactory.cxx index e79518cad1b9..b5b62db089a8 100644 --- a/stoc/source/invocation_adapterfactory/iafactory.cxx +++ b/stoc/source/invocation_adapterfactory/iafactory.cxx @@ -180,7 +180,7 @@ inline void AdapterImpl::release() { t_ptr_map::iterator iFind( m_pFactory->m_receiver2adapters.find( m_key ) ); - OSL_ASSERT( m_pFactory->m_receiver2adapters.end() != iFind ); + assert( m_pFactory->m_receiver2adapters.end() != iFind ); t_ptr_set & adapter_set = iFind->second; if (adapter_set.erase( this ) != 1) { OSL_ASSERT( false ); diff --git a/sw/source/uibase/utlui/uitool.cxx b/sw/source/uibase/utlui/uitool.cxx index 079b5f9fdb1f..fd50bf6678b5 100644 --- a/sw/source/uibase/utlui/uitool.cxx +++ b/sw/source/uibase/utlui/uitool.cxx @@ -285,12 +285,15 @@ void ItemSetToPageDesc( const SfxItemSet& rSet, SwPageDesc& rPageDesc ) if (const SfxGrabBagItem* pGrabBag = rSet.GetItemIfSet(SID_ATTR_CHAR_GRABBAG)) { bool bValue; - if (pGrabBag->GetGrabBag().find("BackgroundFullSize")->second >>= bValue) + const auto pGrabBagInner = pGrabBag->GetGrabBag(); + const auto iter = pGrabBagInner.find("BackgroundFullSize"); + assert(iter != pGrabBagInner.end()); + if (iter->second >>= bValue) { rMaster.SetFormatAttr(SfxBoolItem(RES_BACKGROUND_FULL_SIZE, bValue)); } - auto it = pGrabBag->GetGrabBag().find("RtlGutter"); - if (it != pGrabBag->GetGrabBag().end() && (it->second >>= bValue)) + auto it = pGrabBagInner.find("RtlGutter"); + if (it != pGrabBagInner.end() && (it->second >>= bValue)) { rMaster.SetFormatAttr(SfxBoolItem(RES_RTL_GUTTER, bValue)); } diff --git a/toolkit/source/controls/unocontrolmodel.cxx b/toolkit/source/controls/unocontrolmodel.cxx index de573b11e1a5..0868fc2f6a26 100644 --- a/toolkit/source/controls/unocontrolmodel.cxx +++ b/toolkit/source/controls/unocontrolmodel.cxx @@ -1167,7 +1167,9 @@ void UnoControlModel::getFastPropertyValue( std::unique_lock<std::mutex>& /*rGua rValue = *pProp; else if ( ( nPropId >= BASEPROPERTY_FONTDESCRIPTORPART_START ) && ( nPropId <= BASEPROPERTY_FONTDESCRIPTORPART_END ) ) { - pProp = &( maData.find( BASEPROPERTY_FONTDESCRIPTOR )->second ); + const auto iter = maData.find( BASEPROPERTY_FONTDESCRIPTOR ); + assert(iter != maData.end()); + pProp = &(iter->second); css::awt::FontDescriptor aFD; (*pProp) >>= aFD; switch ( nPropId ) |