changeset 1188:b86dc18802e8

assert that SimpleVector size is positive
author Johannes Hofmann <Johannes.Hofmann@gmx.de>
date Tue, 23 Jun 2009 09:21:18 +0200
parents 104f3aae5721
children 5bbd7b3c8302
files lout/misc.hh
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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.