diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-02-02 09:54:54 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-02-02 10:57:18 +0000 |
commit | d162d0556ecce5b9f7c561a9ba1b88fd5d8c2b0a (patch) | |
tree | f469f3f4c2d1382c0a2c1f5ae776415303e409cd /svtools | |
parent | d67a370f7bd9efffe564b98f80ad3cd039490a47 (diff) |
coverity#1266460 Argument cannot be negative
Change-Id: I715b27b507926e2670cc094d4ebaa429e502232c
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/dialogs/roadmapwizard.cxx | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/svtools/source/dialogs/roadmapwizard.cxx b/svtools/source/dialogs/roadmapwizard.cxx index 8a6587e5394b..64126d7f3225 100644 --- a/svtools/source/dialogs/roadmapwizard.cxx +++ b/svtools/source/dialogs/roadmapwizard.cxx @@ -272,6 +272,8 @@ namespace svt const WizardPath& rActivePath( m_pImpl->aPaths[ m_pImpl->nActivePath ] ); sal_Int32 nCurrentStatePathIndex = m_pImpl->getStateIndexInPath( getCurrentState(), rActivePath ); + if (nCurrentStatePathIndex < 0) + return; // determine up to which index (in the new path) we have to display the items RoadmapTypes::ItemIndex nUpperStepBoundary = (RoadmapTypes::ItemIndex)rActivePath.size(); @@ -332,7 +334,7 @@ namespace svt // there is an item with this index in the roadmap - does it match what is requested by // the respective state in the active path? RoadmapTypes::ItemId nPresentItemId = m_pImpl->pRoadmap->GetItemID( nItemIndex ); - WizardState nRequiredState = rActivePath.at(nItemIndex); + WizardState nRequiredState = rActivePath[ nItemIndex ]; if ( nPresentItemId != nRequiredState ) { m_pImpl->pRoadmap->DeleteRoadmapItem( nItemIndex ); @@ -346,7 +348,7 @@ namespace svt bInsertItem = bNeedItem; } - WizardState nState(rActivePath.at(nItemIndex)); + WizardState nState( rActivePath[ nItemIndex ] ); if ( bInsertItem ) { m_pImpl->pRoadmap->InsertRoadmapItem( @@ -595,6 +597,8 @@ namespace svt sal_Int32 nCurrentStatePathIndex = -1; if ( m_pImpl->nActivePath != -1 ) nCurrentStatePathIndex = m_pImpl->getStateIndexInPath( getCurrentState(), m_pImpl->nActivePath ); + if (nCurrentStatePathIndex < 0) + return; for ( RoadmapTypes::ItemIndex nItemIndex = nCurrentStatePathIndex; nItemIndex < nLoopUntil; ++nItemIndex ) { bool bExistentItem = ( nItemIndex < m_pImpl->pRoadmap->GetItemCount() ); @@ -603,7 +607,7 @@ namespace svt // there is an item with this index in the roadmap - does it match what is requested by // the respective state in the active path? RoadmapTypes::ItemId nPresentItemId = m_pImpl->pRoadmap->GetItemID( nItemIndex ); - WizardState nRequiredState = rActivePath.at(nItemIndex); + WizardState nRequiredState = rActivePath[ nItemIndex ]; if ( _nState == nRequiredState ) { m_pImpl->pRoadmap->ChangeRoadmapItemLabel( nPresentItemId, getStateDisplayName( nRequiredState ) ); |