bugfix correct asserts for nth element stat

This commit is contained in:
Johann Dreo 2013-06-13 16:28:51 +02:00
commit 6f4ecc603b

View file

@ -502,12 +502,13 @@ public:
{ {
unsigned int nth; unsigned int nth;
if( _nth == -1 ) { // asked for a ratio if( _nth == -1 ) { // asked for a ratio
assert( _ratio >= 0 && _ratio <= 1 );
nth = static_cast<unsigned int>( std::floor(_pop.size() * _ratio) ); nth = static_cast<unsigned int>( std::floor(_pop.size() * _ratio) );
} else { } else {
assert( _ratio == -1 ); // asked for a position assert( _ratio == -1 ); // asked for a position
assert( _nth >= 0 );
nth = static_cast<unsigned int>(_nth); nth = static_cast<unsigned int>(_nth);
} }
assert( nth >= 0 );
assert( nth < _pop.size() ); assert( nth < _pop.size() );
if( _pop.size() == 0 ) { if( _pop.size() == 0 ) {