# HG changeset patch # User Johannes Hofmann # Date 1245741678 -7200 # Node ID b86dc18802e855227d0f0b887e8569529b1a08c8 # Parent 104f3aae5721803f8062e263d0ee70c86f6e9231 assert that SimpleVector size is positive diff -r 104f3aae5721 -r b86dc18802e8 lout/misc.hh --- a/lout/misc.hh Tue Jun 23 09:11:42 2009 +0200 +++ b/lout/misc.hh Tue Jun 23 09:21:18 2009 +0200 @@ -138,14 +138,18 @@ * * May be necessary before calling misc::SimpleVector::set. */ - inline void increase() { this->num++; this->resize (); } + inline void increase() { setSize(this->num + 1); } /** * \brief Set the size explicitely. * * May be necessary before calling misc::SimpleVector::set. */ - inline void setSize(int newSize) { this->num = newSize; this->resize (); } + inline void setSize(int newSize) { + assert (newSize >= 0); + this->num = newSize; + this->resize (); + } /** * \brief Set the size explicitely and initialize new values.