Throwing exception when packet size is negative.

This commit is contained in:
Benjamin Bouvier 2012-06-25 13:50:22 +02:00
commit 2cc112c33b

View file

@ -6,7 +6,6 @@
# include <eoFunctor.h> # include <eoFunctor.h>
# include <vector> # include <vector>
template< typename EOT > template< typename EOT >
class ParallelApply : public MpiJob class ParallelApply : public MpiJob
{ {
@ -32,6 +31,10 @@ class ParallelApply : public MpiJob
data( _pop ), data( _pop ),
packetSize( _packetSize ) packetSize( _packetSize )
{ {
if ( _packetSize <= 0 )
{
throw std::runtime_error("Packet size should not be negative.");
}
tempArray = new EOT[ packetSize ]; tempArray = new EOT[ packetSize ];
} }