From bd688656bba77f89e15424ba0394e2a93e002dce Mon Sep 17 00:00:00 2001 From: evomarc Date: Mon, 8 Apr 2002 08:42:46 +0000 Subject: [PATCH] Check that size > 1 (otherwise division by 0) --- eo/src/eoRanking.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/eo/src/eoRanking.h b/eo/src/eoRanking.h index 24edde2e..800232cb 100644 --- a/eo/src/eoRanking.h +++ b/eo/src/eoRanking.h @@ -68,6 +68,9 @@ public: unsigned pSize =_pop.size(); 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().resize(pSize);