Check that size > 1 (otherwise division by 0)
This commit is contained in:
parent
9341d7c229
commit
bd688656bb
1 changed files with 3 additions and 0 deletions
|
|
@ -68,6 +68,9 @@ public:
|
||||||
unsigned pSize =_pop.size();
|
unsigned pSize =_pop.size();
|
||||||
unsigned int pSizeMinusOne = pSize-1;
|
unsigned int pSizeMinusOne = pSize-1;
|
||||||
|
|
||||||
|
if (pSize <= 1)
|
||||||
|
throw runtime_error("Cannot do ranking with population of size <= 1");
|
||||||
|
|
||||||
// value() refers to the vector of worthes (we're in an eoParamvalue)
|
// value() refers to the vector of worthes (we're in an eoParamvalue)
|
||||||
value().resize(pSize);
|
value().resize(pSize);
|
||||||
|
|
||||||
|
|
|
||||||
Reference in a new issue