Trap some bad usage
authorJohn Darrington <john@darrington.wattle.id.au>
Sun, 7 Dec 2008 02:31:05 +0000 (11:31 +0900)
committerJohn Darrington <john@darrington.wattle.id.au>
Sun, 7 Dec 2008 02:31:05 +0000 (11:31 +0900)
lib/gtksheet/psppire-axis-impl.c

index be47d874c2f88b9f079c2fb9a7b2fa85da81c8ab..b722a87b16c4379a69b9ae4c5198c9b417328725 100644 (file)
@@ -313,7 +313,12 @@ void
 psppire_axis_impl_insert (PsppireAxisImpl *a, gint posn, gint size)
 {
   struct axis_node *before = NULL;
-  struct axis_node *new_node = pool_alloc (a->pool, sizeof (*new_node));
+  struct axis_node *new_node;
+
+  g_return_if_fail ( posn < tower_height (&a->unit_tower));
+  g_return_if_fail ( posn >= 0);
+
+  new_node = pool_alloc (a->pool, sizeof (*new_node));
 
   if ( posn > 0)
     {