Let find fail, instead of using a dubious upper bound check

Change-Id: I874ef402d241aa4de02057ca9dc747ae0497b1e0
This commit is contained in:
Matteo Casalin
2016-03-04 23:19:09 +01:00
parent 1d4914e9e5
commit 9f7f577df3

View File

@@ -48,8 +48,7 @@ UniqueIndexImpl::Index UniqueIndexImpl::Insert( void* p )
void* UniqueIndexImpl::Remove( Index nIndex )
{
// Check for valid index
if ( (nIndex >= nStartIndex) &&
(nIndex < (maMap.size() + nStartIndex)) )
if ( nIndex >= nStartIndex )
{
// insert index as empty entry, and reduce indexcount,
// if this entry was used
@@ -68,8 +67,7 @@ void* UniqueIndexImpl::Remove( Index nIndex )
void* UniqueIndexImpl::Get( Index nIndex ) const
{
// check for valid index
if ( (nIndex >= nStartIndex) &&
(nIndex < (maMap.size() + nStartIndex)) )
if ( nIndex >= nStartIndex )
{
std::map<Index, void*>::const_iterator it = maMap.find( nIndex - nStartIndex );
if( it != maMap.end() )